Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue with constraint of an infer type parameter not being fully instantiatable #54205

Conversation

Andarist
Copy link
Contributor

fixes #54197

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label May 10, 2023
@@ -17789,7 +17789,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {

function maybeCloneTypeParameter(p: TypeParameter) {
const constraint = getConstraintOfTypeParameter(p);
return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
return constraint && couldContainTypeVariables(constraint) ? cloneTypeParameter(p) : p;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep thinking that perhaps there is a better check for this kind of thing - but I honestly don't know what it is. I already had a need for this a couple of times and I couldn't find anything else in the codebase that would already test this kind of stuff in a different way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function was introduced back in #31455; I suspect that it was a targeted fix and personally I'm partial to what you're changing it to (it makes sense to me as an optimization; if we always called clone, all tests pass, it's just slower).

@weswigham

@typescript-bot typescript-bot added For Milestone Bug PRs that fix a bug with a specific milestone and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels May 10, 2023
@jakebailey
Copy link
Member

@typescript-bot test this
@typescript-bot test top100
@typescript-bot user test this
@typescript-bot run dt
@typescript-bot perf test this faster
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2023

Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 0519dfa. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2023

Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 0519dfa. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2023

Heya @jakebailey, I've started to run the abridged perf test suite on this PR at 0519dfa. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2023

Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 0519dfa. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2023

Heya @jakebailey, I've started to run the tarball bundle task on this PR at 0519dfa. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2023

Heya @jakebailey, I've started to run the extended test suite on this PR at 0519dfa. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 10, 2023

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/154118/artifacts?artifactName=tgz&fileId=EBD30EA9E7439D2A06D6AD86127F8115C8CFC1EE7CA43284406A7EFDD55BF31102&fileName=/typescript-5.1.0-insiders.20230510.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@5.1.0-pr-54205-7".;

@typescript-bot
Copy link
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

Comparison Report - main..54205

Metric main 54205 Delta Best Worst p-value
Angular - node (v16.17.1, x64)
Memory used 365,267k (± 0.01%) 365,292k (± 0.01%) ~ 365,243k 365,353k p=0.298 n=6
Parse Time 3.56s (± 0.52%) 3.57s (± 0.70%) ~ 3.54s 3.61s p=0.366 n=6
Bind Time 1.17s (± 0.47%) 1.18s (± 1.03%) ~ 1.17s 1.20s p=0.855 n=6
Check Time 9.63s (± 0.46%) 9.61s (± 0.25%) ~ 9.58s 9.65s p=0.571 n=6
Emit Time 7.89s (± 0.50%) 7.88s (± 0.71%) ~ 7.84s 7.99s p=0.520 n=6
Total Time 22.25s (± 0.25%) 22.25s (± 0.27%) ~ 22.17s 22.34s p=1.000 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 193,306k (± 0.69%) 192,714k (± 0.04%) ~ 192,635k 192,808k p=0.230 n=6
Parse Time 1.60s (± 1.96%) 1.61s (± 2.27%) ~ 1.54s 1.64s p=0.625 n=6
Bind Time 0.83s (± 0.99%) 0.83s (± 0.91%) ~ 0.82s 0.84s p=0.729 n=6
Check Time 10.33s (± 0.52%) 10.38s (± 0.71%) ~ 10.28s 10.44s p=0.295 n=6
Emit Time 3.01s (± 0.56%) 3.02s (± 0.95%) ~ 3.00s 3.07s p=0.683 n=6
Total Time 15.77s (± 0.50%) 15.84s (± 0.56%) ~ 15.73s 15.97s p=0.230 n=6
Monaco - node (v16.17.1, x64)
Memory used 345,860k (± 0.00%) 345,863k (± 0.00%) ~ 345,848k 345,876k p=0.810 n=6
Parse Time 2.73s (± 0.71%) 2.73s (± 0.19%) ~ 2.72s 2.73s p=1.000 n=6
Bind Time 1.09s (± 0.47%) 1.08s (± 0.77%) ~ 1.08s 1.10s p=0.533 n=6
Check Time 7.86s (± 0.60%) 7.89s (± 0.46%) ~ 7.83s 7.93s p=0.227 n=6
Emit Time 4.46s (± 0.98%) 4.46s (± 0.67%) ~ 4.42s 4.49s p=0.627 n=6
Total Time 16.14s (± 0.55%) 16.16s (± 0.39%) ~ 16.09s 16.24s p=0.688 n=6
TFS - node (v16.17.1, x64)
Memory used 300,083k (± 0.01%) 300,119k (± 0.01%) +36k (+ 0.01%) 300,098k 300,152k p=0.031 n=6
Parse Time 2.17s (± 0.80%) 2.18s (± 1.11%) ~ 2.16s 2.23s p=0.560 n=6
Bind Time 1.23s (± 0.61%) 1.25s (± 0.44%) +0.02s (+ 1.36%) 1.24s 1.25s p=0.008 n=6
Check Time 7.28s (± 0.40%) 7.32s (± 0.46%) +0.04s (+ 0.62%) 7.27s 7.37s p=0.042 n=6
Emit Time 4.34s (± 0.72%) 4.35s (± 0.66%) ~ 4.31s 4.39s p=1.000 n=6
Total Time 15.02s (± 0.34%) 15.10s (± 0.38%) ~ 15.04s 15.19s p=0.092 n=6
material-ui - node (v16.17.1, x64)
Memory used 480,933k (± 0.01%) 480,912k (± 0.00%) ~ 480,872k 480,935k p=0.471 n=6
Parse Time 3.25s (± 0.36%) 3.25s (± 0.19%) ~ 3.24s 3.26s p=1.000 n=6
Bind Time 0.93s (± 0.59%) 0.94s (± 0.43%) ~ 0.93s 0.94s p=0.282 n=6
Check Time 17.88s (± 1.60%) 17.75s (± 0.45%) ~ 17.64s 17.83s p=0.748 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.06s (± 1.35%) 21.94s (± 0.35%) ~ 21.83s 22.02s p=0.748 n=6
xstate - node (v16.17.1, x64)
Memory used 560,416k (± 0.02%) 560,442k (± 0.02%) ~ 560,335k 560,604k p=0.748 n=6
Parse Time 4.02s (± 0.34%) 4.01s (± 0.27%) ~ 4.00s 4.03s p=0.066 n=6
Bind Time 1.76s (± 0.66%) 1.76s (± 0.46%) ~ 1.75s 1.77s p=1.000 n=6
Check Time 3.06s (± 0.49%) 3.08s (± 0.69%) ~ 3.06s 3.11s p=0.085 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 4.62%) ~ 0.08s 0.09s p=0.405 n=6
Total Time 8.93s (± 0.21%) 8.95s (± 0.20%) ~ 8.93s 8.97s p=0.126 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • Angular - node (v16.17.1, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Monaco - node (v16.17.1, x64)
  • TFS - node (v16.17.1, x64)
  • material-ui - node (v16.17.1, x64)
  • xstate - node (v16.17.1, x64)
Benchmark Name Iterations
Current 54205 6
Baseline main 6

Developer Information:

Download Benchmark

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top-repos suite comparing main and refs/pull/54205/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.
Everything looks the same!
You can check the log here.

@sandersn sandersn requested a review from rbuckton May 22, 2023 23:38
@Andarist
Copy link
Contributor Author

this was already fixed by #57362 so I opened a test-only PR here: #59760

@Andarist Andarist closed this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

...infer X extends TypeParameter[] in conditional type inappropriate binding
4 participants