Skip to content

Propagate outer type parameters of single signature types #57403

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

Merged
merged 5 commits into from
Mar 27, 2024

Conversation

weswigham
Copy link
Member

@weswigham weswigham commented Feb 13, 2024

Fixes #55467

This is wildly more complicated than the issue would make you think, because it uncovers a few issues in how we construct "single signature types" and how that interacts with free type variable inference.

Specifically:

  • Since we project type parameters from outer signatures onto inner expression types, we need to instantiate argument expressions with the inference context mapper to complete those types. The signature mapper would overeagerly instantiate inner call expressions (one of the new tests demonstrates this), so the inference context itself must be used. This isn't wholly unusual - we already instantiate expression types with the inference context in a number of scenarios (at least in the first inference pass when we're looking to fix argument types, or when the expression is maybe a literal type). This just ensures we always do it when we go to check signature argument expression compatibility.
  • Since those inner expression types may reference the type parameters of the signature, when we're within the body of a signature and also checking a call to that same signature, we check against a copy of the signature with fresh type parameters, rather than the original, so we don't confuse references to the type parameters of the signature declaration and the inferred type arguments of the nested call.
  • The single-signature types we produce now capture their outer type parameters (which may come from active inference contexts), so they can be correctly instantiated, so when they contain those projected type parameters, they can be later replaced with the inference results.
  • We discard inferences of the form [A[0]] for A, since "the first element of A is the first element of A" is a tautological inference that adds no useful information, and always yields A's constraint if selected. This improves inferences in scenarios involving a rest parameter alongside another inference site, as in the linked issue.

@typescript-bot
Copy link
Collaborator

Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page.

Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up.

@@ -34265,7 +34299,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
// If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive),
// we obtain the regular type of any object literal arguments because we may not have inferred complete
// parameter types yet and therefore excess property checks may yield false positives (see #17041).
const checkArgType = checkMode & CheckMode.SkipContextSensitive ? getRegularTypeOfObjectLiteral(argType) : argType;
const checkArgType = instantiateType(checkMode & CheckMode.SkipContextSensitive ? getRegularTypeOfObjectLiteral(argType) : argType, signature.mapper);
Copy link
Member Author

Choose a reason for hiding this comment

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

You'd think this'd be a noop, and ask questions like "How does an expression within a signature acquire a reference to a type parameter on the source signature?" or "Shouldn't a signature's mapper only need to be applied to the return type?" - and traditionally you'd be right. But at some point we started projecting the signature's type parameters onto expressions in the arguments contextually (and leaving them generic rather than immediately fixing the inference result), so now the arguments may also need the signature mapper applied to typecheck (usually they do not, but the linked issue is one such case where they do).

This instantiation is basically what makes it OK to type the inner expression in the linked issue as A[0], and get the argument to actually instantiate it to number when it flows back into this signature and successfully typecheck.

// TODO: The signature may reference any outer inference contexts, but we map pop off and then apply new inference contexts, and thus get different inferred types.
// That this is cached on the *first* such attempt is not currently an issue, since expression types *also* get cached on the first pass. If we ever properly speculate, though,
// the cached "isolatedSignatureType" signature field absolutely needs to be included in the list of speculative caches.
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, c => c && map(c.inferences, i => i.typeParameter)).slice());
Copy link
Member Author

Choose a reason for hiding this comment

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

This attaches all type variables being inferred in any active inference contexts as potential outer type parameters for this expression type - that allows them to be further instantiated later on (eg, when the signature those type parameters originally came from resolves and tries to map them into the inference results).

// Inferring A to [A[0]] is a zero information inference (it guarantees A becomes its constraint), but oft arises from generic argument list inferences
// By discarding it early, we can allow more fruitful results to be used instead.
if (isTupleOfSelf(inference.typeParameter, candidate)) {
return;
Copy link
Member Author

Choose a reason for hiding this comment

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

As the comment says, this just discards the bad inference so we can prefer the good one in the example in the linked issue. I think it's a good rule. Without it, we'd infer unknown (from the constraint, since we'd prefer the contravariant [A[0]] to [number]), instead of number.

type.symbol.declarations = [signature.declaration];
type.symbol.valueDeclaration = signature.declaration;
}
outerTypeParameters ||= signature.declaration && getOuterTypeParameters(signature.declaration, /*includeThisTypes*/ true);
Copy link
Member Author

@weswigham weswigham Feb 20, 2024

Choose a reason for hiding this comment

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

This gets the default outer type parameters syntactically, as is normal for most locations. The only exception is the inference context-affected case (which is also the interesting one for this issue), where we may affix type parameters to expressions from places not syntactically enclosing the signature.

@weswigham
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test top100
@typescript-bot user test this
@typescript-bot perf test public

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 20, 2024

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 20, 2024

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 20, 2024

Heya @weswigham, I've started to run the public perf test suite on this PR at f2f9df0. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 20, 2024

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@weswigham Here are the results of running the user test suite comparing main and refs/pull/57403/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Package install failed"

Otherwise...

Something interesting changed - please have a look.

Details

puppeteer

packages/browsers/test/src/tsconfig.json

@typescript-bot
Copy link
Collaborator

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

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
mui-docs - node (v20.5.1, x64)
Memory used 2,405,836k (± 0.01%) 2,407,028k (± 0.01%) +1,193k (+ 0.05%) 2,406,898k 2,407,217k p=0.005 n=6
Parse Time 12.16s (± 1.46%) 12.34s (± 2.99%) ~ 12.08s 13.08s p=0.128 n=6
Bind Time 2.68s (± 0.56%) 2.68s (± 0.93%) ~ 2.63s 2.70s p=0.869 n=6
Check Time 98.26s (± 2.73%) 97.89s (± 2.46%) ~ 94.58s 100.80s p=0.689 n=6
Emit Time 0.30s (± 1.79%) 0.31s (± 1.68%) ~ 0.30s 0.31s p=0.640 n=6
Total Time 113.41s (± 2.47%) 113.22s (± 1.96%) ~ 110.64s 115.95s p=0.936 n=6
self-build-src - node (v20.5.1, x64)
Memory used 2,638,469k (± 5.37%) 2,663,877k (± 5.35%) ~ 2,581,304k 2,929,728k p=0.093 n=6
Parse Time 5.08s (± 1.08%) 5.10s (± 0.86%) ~ 5.06s 5.18s p=0.423 n=6
Bind Time 1.98s (± 0.74%) 1.98s (± 1.00%) ~ 1.95s 2.01s p=0.397 n=6
Check Time 32.31s (± 0.30%) 32.50s (± 0.41%) +0.19s (+ 0.58%) 32.33s 32.73s p=0.030 n=6
Emit Time 2.81s (± 3.37%) 2.84s (± 1.69%) ~ 2.77s 2.91s p=0.296 n=6
Total Time 42.18s (± 0.42%) 42.42s (± 0.22%) +0.24s (+ 0.57%) 42.34s 42.58s p=0.020 n=6
self-compiler - node (v20.5.1, x64)
Memory used 418,551k (± 0.02%) 419,163k (± 0.02%) +611k (+ 0.15%) 419,079k 419,247k p=0.005 n=6
Parse Time 2.89s (± 0.56%) 2.90s (± 1.36%) ~ 2.83s 2.95s p=0.681 n=6
Bind Time 1.13s (± 0.46%) 1.14s (± 0.72%) ~ 1.13s 1.15s p=0.523 n=6
Check Time 14.21s (± 0.33%) 14.37s (± 0.29%) +0.16s (+ 1.14%) 14.31s 14.43s p=0.005 n=6
Emit Time 1.04s (± 1.70%) 1.04s (± 1.22%) ~ 1.03s 1.06s p=0.607 n=6
Total Time 19.27s (± 0.23%) 19.45s (± 0.18%) +0.18s (+ 0.93%) 19.41s 19.50s p=0.005 n=6
vscode - node (v20.5.1, x64)
Memory used 2,889,604k (± 0.01%) 2,895,260k (± 0.00%) +5,655k (+ 0.20%) 2,895,233k 2,895,295k p=0.005 n=6
Parse Time 10.86s (± 0.19%) 10.89s (± 0.28%) ~ 10.84s 10.92s p=0.090 n=6
Bind Time 3.49s (± 0.47%) 3.49s (± 0.40%) ~ 3.47s 3.51s p=0.869 n=6
Check Time 58.35s (± 0.55%) 58.73s (± 0.60%) +0.38s (+ 0.66%) 58.29s 59.18s p=0.045 n=6
Emit Time 17.16s (± 8.97%) 16.55s (± 0.74%) ~ 16.39s 16.68s p=0.810 n=6
Total Time 89.86s (± 2.04%) 89.66s (± 0.38%) ~ 89.33s 90.17s p=0.128 n=6
webpack - node (v20.5.1, x64)
Memory used 398,811k (± 0.00%) 399,482k (± 0.01%) +671k (+ 0.17%) 399,451k 399,566k p=0.005 n=6
Parse Time 3.38s (± 0.31%) 3.39s (± 0.39%) ~ 3.38s 3.41s p=0.181 n=6
Bind Time 1.45s (± 0.84%) 1.45s (± 0.35%) ~ 1.45s 1.46s p=0.672 n=6
Check Time 13.10s (± 0.15%) 13.10s (± 0.20%) ~ 13.05s 13.13s p=0.934 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 17.93s (± 0.14%) 17.94s (± 0.16%) ~ 17.90s 17.98s p=0.747 n=6
System info unknown
Hosts
  • node (v20.5.1, x64)
Scenarios
  • mui-docs - node (v20.5.1, x64)
  • self-build-src - node (v20.5.1, x64)
  • self-compiler - node (v20.5.1, x64)
  • vscode - node (v20.5.1, x64)
  • webpack - node (v20.5.1, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

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

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

pmndrs/zustand

tsconfig.json

@weswigham
Copy link
Member Author

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 21, 2024

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 21, 2024

Hey @weswigham, 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/159965/artifacts?artifactName=tgz&fileId=4EF81D5ED0773B8988644BE963B90A1E680E7AE3BAC9D649A76C45B8DEB20E4A02&fileName=/typescript-5.5.0-insiders.20240221.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.5.0-pr-57403-12".;

…xpressions with the context, rather than the signature mapper
@weswigham
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test top100
@typescript-bot user test this
@typescript-bot perf test public

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 21, 2024

Heya @weswigham, I've started to run the public perf test suite on this PR at 0822f33. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 21, 2024

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 21, 2024

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 21, 2024

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@weswigham Here are the results of running the user test suite comparing main and refs/pull/57403/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Package install failed"

Otherwise...

Something interesting changed - please have a look.

Details

puppeteer

packages/browsers/test/src/tsconfig.json

@typescript-bot
Copy link
Collaborator

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

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
mui-docs - node (v20.5.1, x64)
Memory used 2,405,820k (± 0.01%) 2,406,974k (± 0.01%) +1,154k (+ 0.05%) 2,406,696k 2,407,147k p=0.005 n=6
Parse Time 12.14s (± 1.04%) 12.36s (± 1.78%) ~ 12.03s 12.63s p=0.149 n=6
Bind Time 2.67s (± 0.69%) 2.80s (±11.70%) ~ 2.64s 3.47s p=0.872 n=6
Check Time 98.33s (± 2.78%) 97.94s (± 2.66%) ~ 93.68s 100.89s p=1.000 n=6
Emit Time 0.31s (± 0.00%) 0.65s (±128.00%) ~ 0.31s 2.35s p=0.405 n=6
Total Time 113.45s (± 2.48%) 113.75s (± 2.63%) ~ 109.49s 117.61s p=0.936 n=6
self-build-src - node (v20.5.1, x64)
Memory used 2,638,383k (± 5.37%) 2,581,747k (± 0.02%) ~ 2,581,134k 2,582,214k p=0.066 n=6
Parse Time 5.05s (± 0.96%) 5.10s (± 0.87%) ~ 5.03s 5.16s p=0.109 n=6
Bind Time 1.99s (± 1.41%) 2.00s (± 1.09%) ~ 1.97s 2.03s p=0.686 n=6
Check Time 32.35s (± 0.16%) 32.57s (± 0.26%) +0.22s (+ 0.66%) 32.50s 32.71s p=0.005 n=6
Emit Time 2.80s (± 2.23%) 2.77s (± 4.12%) ~ 2.59s 2.95s p=0.689 n=6
Total Time 42.21s (± 0.23%) 42.46s (± 0.45%) +0.25s (+ 0.59%) 42.20s 42.71s p=0.025 n=6
self-compiler - node (v20.5.1, x64)
Memory used 418,544k (± 0.02%) 419,112k (± 0.01%) +569k (+ 0.14%) 419,028k 419,161k p=0.005 n=6
Parse Time 2.89s (± 0.66%) 2.89s (± 0.87%) ~ 2.85s 2.92s p=0.872 n=6
Bind Time 1.13s (± 0.66%) 1.14s (± 0.45%) ~ 1.13s 1.14s p=0.247 n=6
Check Time 14.19s (± 0.11%) 14.32s (± 0.26%) +0.13s (+ 0.88%) 14.25s 14.36s p=0.005 n=6
Emit Time 1.03s (± 1.00%) 1.05s (± 1.64%) ~ 1.03s 1.07s p=0.114 n=6
Total Time 19.25s (± 0.16%) 19.39s (± 0.20%) +0.14s (+ 0.73%) 19.31s 19.42s p=0.005 n=6
vscode - node (v20.5.1, x64)
Memory used 2,890,448k (± 0.00%) 2,893,599k (± 0.01%) +3,151k (+ 0.11%) 2,893,294k 2,893,709k p=0.005 n=6
Parse Time 10.87s (± 0.13%) 10.85s (± 0.32%) ~ 10.82s 10.90s p=0.466 n=6
Bind Time 3.49s (± 0.89%) 3.49s (± 0.49%) ~ 3.46s 3.51s p=0.366 n=6
Check Time 58.49s (± 0.31%) 58.60s (± 0.39%) ~ 58.28s 58.90s p=0.423 n=6
Emit Time 16.60s (± 0.27%) 17.18s (± 8.85%) ~ 16.46s 20.29s p=0.936 n=6
Total Time 89.45s (± 0.26%) 90.13s (± 1.79%) ~ 89.15s 93.39s p=0.689 n=6
webpack - node (v20.5.1, x64)
Memory used 399,033k (± 0.01%) 399,328k (± 0.01%) +295k (+ 0.07%) 399,271k 399,422k p=0.005 n=6
Parse Time 3.38s (± 0.45%) 3.38s (± 0.31%) ~ 3.36s 3.39s p=0.934 n=6
Bind Time 1.45s (± 0.80%) 1.45s (± 1.07%) ~ 1.43s 1.47s p=0.869 n=6
Check Time 13.11s (± 0.31%) 13.11s (± 0.21%) ~ 13.08s 13.15s p=1.000 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 17.94s (± 0.24%) 17.94s (± 0.25%) ~ 17.89s 17.99s p=0.872 n=6
System info unknown
Hosts
  • node (v20.5.1, x64)
Scenarios
  • mui-docs - node (v20.5.1, x64)
  • self-build-src - node (v20.5.1, x64)
  • self-compiler - node (v20.5.1, x64)
  • vscode - node (v20.5.1, x64)
  • webpack - node (v20.5.1, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

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

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

immich-app/immich

5 of 8 projects failed to build with the old tsc and were ignored

server/tsconfig.build.json

server/tsconfig.json

microsoft/vscode

3 of 54 projects failed to build with the old tsc and were ignored

src/tsconfig.json

  • error TS2322: Type '((T & object)[Extract<keyof T, string>] & object)[Extract<keyof (T & object)[Extract<keyof T, string>], string>]' is not assignable to type '(T & object)[Extract<keyof T, string>]'.

src/tsconfig.monaco.json

  • error TS2322: Type '((T & object)[Extract<keyof T, string>] & object)[Extract<keyof (T & object)[Extract<keyof T, string>], string>]' is not assignable to type '(T & object)[Extract<keyof T, string>]'.

src/tsconfig.tsec.json

  • error TS2322: Type '((T & object)[Extract<keyof T, string>] & object)[Extract<keyof (T & object)[Extract<keyof T, string>], string>]' is not assignable to type '(T & object)[Extract<keyof T, string>]'.

pmndrs/zustand

tsconfig.json

@fatcerberus
Copy link

*propagate. Sorry, I had to.

@weswigham weswigham changed the title Propegate outer type parameters of single signature types Propagate outer type parameters of single signature types Feb 29, 2024
@weswigham
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test top100
@typescript-bot user test this
@typescript-bot perf test public

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 29, 2024

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 29, 2024

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 29, 2024

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 29, 2024

Heya @weswigham, I've started to run the public perf test suite on this PR at 17cbcca. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@weswigham Here are the results of running the user test suite comparing main and refs/pull/57403/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Package install failed"

Otherwise...

Something interesting changed - please have a look.

Details

puppeteer

packages/browsers/test/src/tsconfig.json

@typescript-bot
Copy link
Collaborator

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

@typescript-bot
Copy link
Collaborator

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

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v20.5.1, x64)
Memory used 191,643k (± 1.08%) 192,367k (± 0.95%) ~ 189,823k 193,549k p=0.230 n=6
Parse Time 1.37s (± 1.11%) 1.38s (± 0.30%) +0.02s (+ 1.22%) 1.38s 1.39s p=0.045 n=6
Bind Time 0.75s (± 1.19%) 0.75s (± 1.38%) ~ 0.73s 0.76s p=0.673 n=6
Check Time 8.91s (± 0.92%) 8.94s (± 0.99%) ~ 8.81s 9.06s p=0.748 n=6
Emit Time 2.69s (± 0.87%) 2.69s (± 0.99%) ~ 2.64s 2.71s p=1.000 n=6
Total Time 13.72s (± 0.69%) 13.75s (± 0.68%) ~ 13.63s 13.90s p=0.470 n=6
mui-docs - node (v20.5.1, x64)
Memory used 2,407,726k (± 0.01%) 2,409,052k (± 0.00%) +1,327k (+ 0.06%) 2,408,912k 2,409,103k p=0.005 n=6
Parse Time 12.22s (± 0.64%) 12.26s (± 1.29%) ~ 12.09s 12.52s p=0.747 n=6
Bind Time 2.78s (±10.47%) 2.66s (± 0.84%) ~ 2.64s 2.70s p=0.807 n=6
Check Time 98.14s (± 2.27%) 97.45s (± 1.26%) ~ 95.76s 99.16s p=0.936 n=6
Emit Time 0.30s (± 1.70%) 0.31s (± 1.68%) ~ 0.30s 0.31s p=0.311 n=6
Total Time 113.45s (± 2.01%) 112.67s (± 1.14%) ~ 111.04s 114.66s p=0.689 n=6
self-build-src - node (v20.5.1, x64)
Memory used 2,561,690k (± 0.02%) 2,620,073k (± 5.35%) +58,382k (+ 2.28%) 2,561,764k 2,906,390k p=0.020 n=6
Parse Time 5.22s (± 0.80%) 5.22s (± 0.63%) ~ 5.18s 5.26s p=0.686 n=6
Bind Time 2.02s (± 0.41%) 2.02s (± 0.49%) ~ 2.01s 2.03s p=0.588 n=6
Check Time 32.39s (± 0.29%) 32.59s (± 0.39%) +0.20s (+ 0.62%) 32.38s 32.74s p=0.025 n=6
Emit Time 2.73s (± 1.40%) 2.75s (± 1.79%) ~ 2.70s 2.81s p=0.521 n=6
Total Time 42.39s (± 0.21%) 42.59s (± 0.31%) +0.20s (+ 0.47%) 42.47s 42.78s p=0.031 n=6
self-compiler - node (v20.5.1, x64)
Memory used 413,988k (± 0.01%) 414,778k (± 0.02%) +790k (+ 0.19%) 414,707k 414,890k p=0.005 n=6
Parse Time 2.90s (± 0.36%) 2.88s (± 0.38%) -0.02s (- 0.52%) 2.86s 2.89s p=0.046 n=6
Bind Time 1.13s (± 0.36%) 1.14s (± 1.36%) ~ 1.12s 1.16s p=0.421 n=6
Check Time 14.13s (± 0.27%) 14.21s (± 0.28%) +0.08s (+ 0.58%) 14.17s 14.26s p=0.024 n=6
Emit Time 1.01s (± 1.61%) 1.02s (± 1.07%) ~ 1.00s 1.03s p=0.560 n=6
Total Time 19.17s (± 0.23%) 19.25s (± 0.21%) +0.08s (+ 0.42%) 19.19s 19.31s p=0.016 n=6
vscode - node (v20.5.1, x64)
Memory used 2,896,603k (± 0.00%) 2,899,854k (± 0.00%) +3,251k (+ 0.11%) 2,899,828k 2,899,878k p=0.005 n=6
Parse Time 10.87s (± 0.15%) 10.90s (± 0.27%) ~ 10.86s 10.94s p=0.255 n=6
Bind Time 3.51s (± 0.28%) 3.50s (± 0.50%) ~ 3.47s 3.52s p=0.216 n=6
Check Time 58.44s (± 0.31%) 58.55s (± 0.50%) ~ 58.16s 58.93s p=0.471 n=6
Emit Time 16.51s (± 0.25%) 16.58s (± 0.61%) ~ 16.46s 16.73s p=0.295 n=6
Total Time 89.34s (± 0.24%) 89.52s (± 0.43%) ~ 89.01s 89.98s p=0.378 n=6
webpack - node (v20.5.1, x64)
Memory used 400,027k (± 0.00%) 400,377k (± 0.01%) +350k (+ 0.09%) 400,344k 400,426k p=0.005 n=6
Parse Time 3.41s (± 0.80%) 3.39s (± 0.90%) ~ 3.35s 3.43s p=0.564 n=6
Bind Time 1.42s (± 0.69%) 1.42s (± 0.97%) ~ 1.41s 1.44s p=0.677 n=6
Check Time 13.06s (± 0.27%) 13.08s (± 0.18%) ~ 13.05s 13.11s p=0.419 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 17.89s (± 0.21%) 17.89s (± 0.22%) ~ 17.84s 17.95s p=1.000 n=6
System info unknown
Hosts
  • node (v20.5.1, x64)
Scenarios
  • Compiler-Unions - node (v20.5.1, x64)
  • mui-docs - node (v20.5.1, x64)
  • self-build-src - node (v20.5.1, x64)
  • self-compiler - node (v20.5.1, x64)
  • vscode - node (v20.5.1, x64)
  • webpack - node (v20.5.1, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

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

Everything looks good!

@weswigham weswigham marked this pull request as ready for review February 29, 2024 19:36
@weswigham
Copy link
Member Author

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 5, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
pack this ✅ Started

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 5, 2024

Hey @weswigham, 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/160206/artifacts?artifactName=tgz&fileId=574D6E6658D6BECD4725E72A38C2D5C994F69D0856AA6F4862446837309E87CE02&fileName=/typescript-5.5.0-insiders.20240305.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.5.0-pr-57403-34".;

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

From what I remember from your previous explanation, this seemed good to go?

@@ -7088,7 +7089,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {

const abstractSignatures = filter(resolved.constructSignatures, signature => !!(signature.flags & SignatureFlags.Abstract));
if (some(abstractSignatures)) {
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
const types = map(abstractSignatures, s => getOrCreateTypeFromSignature(s));
Copy link
Member

Choose a reason for hiding this comment

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

Is this leftover from a previous refactor?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, it's just the second optional param not being assignable to map's param.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nested generic function inference causes unbound type parameter leak
4 participants