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

Fix reference marking of values merged with unresolvable type-only imports #54799

Merged
merged 2 commits into from Aug 3, 2023

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Jun 27, 2023

In #50853, I identified several cases where a symbol was incorrectly being reported as unusable in emit locations due to being a type-only import, when it was actually a local value merged with a type-only import:

// @Filename: a.ts
export interface A {}

// @Filename: b.ts
import type { A } from "./a";
const A = {};
A; // Error: A cannot be used as a value because it was imported with 'import type' 👎

The original code simply looked to see if the symbol resolved to any type-only import or export, which was obviously insufficient for merged symbols. Ideally, we wanted to know which declarations contributed which meanings to the merged symbol’s flags. That information isn’t tracked, though, so in #50853 I implemented a bit of proxy logic to get close: if the yet-unresolved alias symbol has a value meaning, and the type-only import symbol doesn’t, then we know the value meaning could not have come from the type-only import, so it’s safe to use. In code, that was something like

symbol.flags & SymbolFlags.Value &&
!(resolveAlias(getTypeOnlyAliasDeclaration(symbol).symbol).flags & SymbolFlags.Value)

So in the example above, symbol.flags would have Alias|Variable (and Variable counts as a Value), and the resolution of A starting at the type-only import would have Interface. The new logic correctly allowed A to be referenced as a value.

So we were kind of picking apart the pieces of the merged symbol, performing some alias resolution independently on the parts, and using the process of elimination to determine where the SymbolFlags.Value meaning must have come from. (The key thing that makes this work is that separate values are not allowed to merge across modules through an import—e.g., even though a function and a namespace can merge in the same file, you can’t import a function f and then declare an instantiated namespace f. That’s always been an error.)

However, this logic breaks down if the type-only import cannot be resolved, as in ts.transpileModule. The symbol returned by resolveAlias for an unresolvable alias is unknownSymbol, which has all symbol flags, to denote that it could be anything. So looking at the example through the old code again:

symbol.flags & SymbolFlags.Value &&
!(resolveAlias(getTypeOnlyAliasDeclaration(symbol).symbol).flags & SymbolFlags.Value)

symbol.flags & SymbolFlags.Value is still true, but this time, resolveAlias(getTypeOnlyAliasDeclaration(symbol).symbol) is unknownSymbol, which also has SymbolFlags.Value, so the incorrect assumption is that the value meaning for A must have come from the type-only import.

This PR replaces that strategy with one that collects flags starting at the merged symbol, and stops just before it gets to the resolution of the type-only import.

Fixes #54526

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug 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 Jun 27, 2023
Comment on lines 4461 to 4469
const typeOnlyDeclaration = excludeTypeOnlyMeanings && getTypeOnlyAliasDeclaration(symbol);
const typeOnlyResolution = typeOnlyDeclaration && resolveAlias(typeOnlyDeclaration.symbol);
let flags = symbol.flags;
let seenSymbols;
while (symbol.flags & SymbolFlags.Alias) {
const target = resolveAlias(symbol);
if (target === typeOnlyResolution) {
break;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

The indentation on this function was messed up, so I recommend viewing it with whitespace changes hidden. These few lines are the core change that I mentioned in the PR description.

Copy link
Member

Choose a reason for hiding this comment

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

(dprint when?)

Copy link
Member Author

Choose a reason for hiding this comment

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

My thoughts exactly 👀

@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.

exports.x = void 0;
exports.x = exports.A = void 0;
var A = a.A; // Error
exports.A = A;
Copy link
Member Author

Choose a reason for hiding this comment

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

Some illegal merges that were previously counted as unreferenced for purposes of emit are now counted as referenced. Stuff is going to crash either way, and I don’t really think one is particularly more correct than the other.

@sandersn sandersn added this to Not started in PR Backlog Jul 18, 2023
@sandersn sandersn moved this from Not started to Waiting on reviewers in PR Backlog Jul 18, 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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 24, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 24, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 24, 2023

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 24, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 24, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

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

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Unknown failure"
  • 1 instance of "Package install failed"

Otherwise...

Something interesting changed - please have a look.

Details

rxjs-src

/mnt/ts_downloads/rxjs-src/build.sh

  • [NEW] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54799/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
  • [MISSING] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)

@typescript-bot
Copy link
Collaborator

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

Here they are:

Compiler

Comparison Report - main..54799
Metric main 54799 Delta Best Worst p-value
Angular - node (v18.10.0, x64)
Memory used 368,762k (± 0.00%) 368,793k (± 0.01%) +31k (+ 0.01%) 368,759k 368,811k p=0.031 n=6
Parse Time 3.39s (± 0.47%) 3.40s (± 0.52%) ~ 3.37s 3.42s p=0.511 n=6
Bind Time 1.12s (± 0.49%) 1.12s (± 0.73%) ~ 1.11s 1.13s p=0.859 n=6
Check Time 8.90s (± 0.53%) 8.95s (± 0.55%) ~ 8.88s 9.02s p=0.146 n=6
Emit Time 7.50s (± 0.24%) 7.50s (± 0.47%) ~ 7.46s 7.55s p=0.872 n=6
Total Time 20.91s (± 0.27%) 20.96s (± 0.30%) ~ 20.90s 21.08s p=0.149 n=6
Compiler-Unions - node (v18.10.0, x64)
Memory used 192,093k (± 0.02%) 192,487k (± 0.51%) ~ 192,033k 194,510k p=1.000 n=6
Parse Time 1.50s (± 0.56%) 1.50s (± 0.34%) ~ 1.49s 1.50s p=0.073 n=6
Bind Time 0.77s (± 0.82%) 0.77s (± 0.53%) ~ 0.76s 0.77s p=0.673 n=6
Check Time 9.49s (± 0.52%) 9.48s (± 0.77%) ~ 9.39s 9.56s p=1.000 n=6
Emit Time 2.77s (± 1.28%) 2.75s (± 1.07%) ~ 2.71s 2.79s p=0.147 n=6
Total Time 14.54s (± 0.50%) 14.49s (± 0.56%) ~ 14.38s 14.62s p=0.574 n=6
Monaco - node (v18.10.0, x64)
Memory used 347,760k (± 0.01%) 347,768k (± 0.01%) ~ 347,737k 347,792k p=0.689 n=6
Parse Time 2.61s (± 1.25%) 2.63s (± 1.33%) ~ 2.58s 2.67s p=0.295 n=6
Bind Time 1.01s (± 1.03%) 1.02s (± 0.88%) ~ 1.01s 1.03s p=0.452 n=6
Check Time 7.32s (± 0.45%) 7.28s (± 0.50%) ~ 7.24s 7.33s p=0.188 n=6
Emit Time 4.26s (± 0.98%) 4.25s (± 0.69%) ~ 4.21s 4.28s p=1.000 n=6
Total Time 15.19s (± 0.52%) 15.18s (± 0.35%) ~ 15.10s 15.23s p=0.470 n=6
TFS - node (v18.10.0, x64)
Memory used 301,777k (± 0.01%) 301,764k (± 0.01%) ~ 301,747k 301,794k p=0.470 n=6
Parse Time 2.10s (± 1.79%) 2.08s (± 0.89%) ~ 2.05s 2.10s p=0.413 n=6
Bind Time 1.13s (± 1.30%) 1.12s (± 0.73%) ~ 1.11s 1.13s p=0.677 n=6
Check Time 6.64s (± 0.57%) 6.68s (± 0.74%) ~ 6.62s 6.76s p=0.125 n=6
Emit Time 3.85s (± 1.04%) 3.86s (± 0.97%) ~ 3.80s 3.90s p=0.810 n=6
Total Time 13.72s (± 0.53%) 13.75s (± 0.59%) ~ 13.65s 13.85s p=0.469 n=6
material-ui - node (v18.10.0, x64)
Memory used 482,559k (± 0.01%) 482,629k (± 0.01%) ~ 482,570k 482,731k p=0.065 n=6
Parse Time 3.10s (± 1.91%) 3.09s (± 1.58%) ~ 3.01s 3.14s p=0.625 n=6
Bind Time 0.93s (± 4.10%) 0.92s (± 1.27%) ~ 0.91s 0.94s p=1.000 n=6
Check Time 17.30s (± 0.87%) 17.34s (± 0.50%) ~ 17.22s 17.47s p=0.196 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 21.33s (± 0.72%) 21.35s (± 0.42%) ~ 21.20s 21.44s p=0.297 n=6
xstate - node (v18.10.0, x64)
Memory used 563,778k (± 0.02%) 563,721k (± 0.02%) ~ 563,614k 563,856k p=0.471 n=6
Parse Time 3.86s (± 0.21%) 3.84s (± 0.56%) ~ 3.82s 3.87s p=0.292 n=6
Bind Time 1.66s (± 0.70%) 1.65s (± 1.42%) ~ 1.60s 1.66s p=0.498 n=6
Check Time 2.82s (± 1.08%) 2.80s (± 0.32%) ~ 2.79s 2.81s p=0.168 n=6
Emit Time 0.08s (± 0.00%) 0.08s (± 0.00%) ~ 0.08s 0.08s p=1.000 n=6
Total Time 8.41s (± 0.44%) 8.37s (± 0.40%) ~ 8.32s 8.40s p=0.106 n=6
Angular - node (v16.17.1, x64)
Memory used 368,205k (± 0.00%) 368,209k (± 0.01%) ~ 368,177k 368,258k p=0.810 n=6
Parse Time 3.58s (± 0.41%) 3.56s (± 0.82%) ~ 3.53s 3.60s p=0.256 n=6
Bind Time 1.19s (± 0.98%) 1.18s (± 0.46%) ~ 1.18s 1.19s p=0.498 n=6
Check Time 9.71s (± 0.27%) 9.75s (± 0.24%) +0.04s (+ 0.39%) 9.72s 9.79s p=0.029 n=6
Emit Time 7.99s (± 0.52%) 7.98s (± 0.58%) ~ 7.93s 8.06s p=0.629 n=6
Total Time 22.47s (± 0.27%) 22.47s (± 0.27%) ~ 22.41s 22.57s p=1.000 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 194,944k (± 0.88%) 194,353k (± 0.66%) ~ 193,820k 196,981k p=0.173 n=6
Parse Time 1.57s (± 0.78%) 1.57s (± 0.84%) ~ 1.56s 1.59s p=0.729 n=6
Bind Time 0.82s (± 1.27%) 0.82s (± 0.92%) ~ 0.81s 0.83s p=0.273 n=6
Check Time 10.13s (± 0.53%) 10.16s (± 0.25%) ~ 10.13s 10.20s p=0.293 n=6
Emit Time 3.02s (± 1.01%) 2.99s (± 0.51%) ~ 2.97s 3.01s p=0.063 n=6
Total Time 15.55s (± 0.26%) 15.54s (± 0.22%) ~ 15.48s 15.58s p=0.630 n=6
Monaco - node (v16.17.1, x64)
Memory used 347,082k (± 0.01%) 347,072k (± 0.00%) ~ 347,055k 347,094k p=0.422 n=6
Parse Time 2.77s (± 1.02%) 2.77s (± 0.44%) ~ 2.75s 2.78s p=0.935 n=6
Bind Time 1.07s (± 0.96%) 1.08s (± 0.51%) ~ 1.07s 1.08s p=0.663 n=6
Check Time 8.04s (± 0.44%) 8.02s (± 0.56%) ~ 7.94s 8.08s p=1.000 n=6
Emit Time 4.47s (± 0.58%) 4.46s (± 0.42%) ~ 4.44s 4.48s p=0.935 n=6
Total Time 16.34s (± 0.39%) 16.32s (± 0.36%) ~ 16.21s 16.38s p=0.629 n=6
TFS - node (v16.17.1, x64)
Memory used 301,098k (± 0.00%) 301,088k (± 0.00%) ~ 301,068k 301,106k p=0.335 n=6
Parse Time 2.20s (± 0.41%) 2.19s (± 0.37%) ~ 2.18s 2.20s p=0.270 n=6
Bind Time 1.22s (± 0.45%) 1.22s (± 1.54%) ~ 1.20s 1.25s p=0.498 n=6
Check Time 7.31s (± 0.33%) 7.35s (± 0.48%) ~ 7.30s 7.39s p=0.124 n=6
Emit Time 4.32s (± 0.90%) 4.33s (± 0.84%) ~ 4.28s 4.39s p=0.627 n=6
Total Time 15.04s (± 0.31%) 15.08s (± 0.39%) ~ 15.02s 15.17s p=0.286 n=6
material-ui - node (v16.17.1, x64)
Memory used 481,865k (± 0.02%) 481,887k (± 0.01%) ~ 481,854k 481,932k p=0.378 n=6
Parse Time 3.25s (± 0.63%) 3.24s (± 0.51%) ~ 3.22s 3.27s p=0.514 n=6
Bind Time 0.95s (± 1.10%) 0.95s (± 0.94%) ~ 0.94s 0.96s p=0.452 n=6
Check Time 18.37s (± 0.73%) 18.35s (± 0.41%) ~ 18.26s 18.47s p=0.936 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.58s (± 0.66%) 22.54s (± 0.32%) ~ 22.46s 22.65s p=1.000 n=6
xstate - node (v16.17.1, x64)
Memory used 561,402k (± 0.02%) 561,497k (± 0.03%) ~ 561,338k 561,728k p=0.471 n=6
Parse Time 4.02s (± 0.46%) 4.01s (± 0.26%) ~ 4.00s 4.03s p=0.195 n=6
Bind Time 1.77s (± 0.47%) 1.71s (± 5.54%) ~ 1.58s 1.78s p=0.065 n=6
Check Time 3.05s (± 0.25%) 3.11s (± 3.38%) ~ 3.01s 3.25s p=0.369 n=6
Emit Time 0.09s (± 8.20%) 0.09s (±11.12%) ~ 0.08s 0.10s p=0.554 n=6
Total Time 8.94s (± 0.20%) 8.93s (± 0.20%) ~ 8.90s 8.94s p=0.075 n=6
Angular - node (v14.21.3, x64)
Memory used 362,119k (± 0.01%) 362,126k (± 0.00%) ~ 362,113k 362,143k p=0.298 n=6
Parse Time 3.73s (± 0.60%) 3.73s (± 0.59%) ~ 3.71s 3.77s p=0.865 n=6
Bind Time 1.22s (± 0.42%) 1.23s (± 0.99%) ~ 1.21s 1.24s p=0.666 n=6
Check Time 10.11s (± 0.31%) 10.15s (± 0.33%) ~ 10.12s 10.19s p=0.053 n=6
Emit Time 8.36s (± 0.55%) 8.32s (± 0.43%) ~ 8.26s 8.36s p=0.108 n=6
Total Time 23.42s (± 0.35%) 23.42s (± 0.27%) ~ 23.37s 23.54s p=0.748 n=6
Compiler-Unions - node (v14.21.3, x64)
Memory used 189,133k (± 0.01%) 189,148k (± 0.01%) ~ 189,108k 189,171k p=0.298 n=6
Parse Time 1.61s (± 0.68%) 1.61s (± 0.68%) ~ 1.60s 1.63s p=1.000 n=6
Bind Time 0.85s (± 1.22%) 0.85s (± 0.96%) ~ 0.84s 0.86s p=0.928 n=6
Check Time 10.32s (± 0.52%) 10.31s (± 0.71%) ~ 10.21s 10.39s p=0.935 n=6
Emit Time 3.14s (± 0.91%) 3.11s (± 0.78%) ~ 3.09s 3.15s p=0.124 n=6
Total Time 15.92s (± 0.47%) 15.89s (± 0.57%) ~ 15.76s 16.01s p=0.748 n=6
Monaco - node (v14.21.3, x64)
Memory used 342,063k (± 0.01%) 342,090k (± 0.01%) +28k (+ 0.01%) 342,063k 342,113k p=0.031 n=6
Parse Time 2.81s (± 0.27%) 2.80s (± 0.35%) ~ 2.79s 2.81s p=0.300 n=6
Bind Time 1.09s (± 0.37%) 1.09s (± 0.47%) ~ 1.09s 1.10s p=0.595 n=6
Check Time 8.28s (± 0.46%) 8.31s (± 0.19%) ~ 8.28s 8.32s p=0.087 n=6
Emit Time 4.64s (± 0.37%) 4.66s (± 0.46%) ~ 4.63s 4.68s p=0.105 n=6
Total Time 16.82s (± 0.33%) 16.87s (± 0.17%) ~ 16.84s 16.91s p=0.088 n=6
TFS - node (v14.21.3, x64)
Memory used 296,193k (± 0.00%) 296,206k (± 0.01%) ~ 296,185k 296,235k p=0.261 n=6
Parse Time 2.42s (± 1.26%) 2.42s (± 0.71%) ~ 2.40s 2.45s p=0.936 n=6
Bind Time 1.09s (± 1.71%) 1.07s (± 1.24%) ~ 1.05s 1.09s p=0.180 n=6
Check Time 7.65s (± 0.48%) 7.63s (± 0.13%) ~ 7.61s 7.64s p=0.326 n=6
Emit Time 4.31s (± 0.73%) 4.29s (± 0.65%) ~ 4.25s 4.33s p=0.518 n=6
Total Time 15.47s (± 0.42%) 15.42s (± 0.35%) ~ 15.35s 15.49s p=0.259 n=6
material-ui - node (v14.21.3, x64)
Memory used 477,357k (± 0.00%) 477,367k (± 0.00%) ~ 477,353k 477,415k p=0.229 n=6
Parse Time 3.29s (± 0.42%) 3.30s (± 0.41%) ~ 3.29s 3.32s p=0.273 n=6
Bind Time 0.99s (± 0.76%) 0.99s (± 0.76%) ~ 0.98s 1.00s p=1.000 n=6
Check Time 19.21s (± 0.64%) 19.17s (± 0.34%) ~ 19.10s 19.28s p=0.687 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 23.50s (± 0.56%) 23.47s (± 0.26%) ~ 23.40s 23.56s p=0.810 n=6
xstate - node (v14.21.3, x64)
Memory used 550,140k (± 0.01%) 550,191k (± 0.01%) +51k (+ 0.01%) 550,152k 550,238k p=0.030 n=6
Parse Time 4.20s (± 0.25%) 4.20s (± 0.58%) ~ 4.18s 4.24s p=0.683 n=6
Bind Time 1.68s (± 2.39%) 1.70s (± 0.48%) ~ 1.69s 1.71s p=0.134 n=6
Check Time 3.12s (± 0.29%) 3.13s (± 0.45%) ~ 3.11s 3.15s p=0.329 n=6
Emit Time 0.09s (± 4.45%) 0.09s (± 5.76%) ~ 0.09s 0.10s p=0.282 n=6
Total Time 9.09s (± 0.41%) 9.12s (± 0.30%) ~ 9.10s 9.16s p=0.253 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 (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.21.3, x64)
Scenarios
  • Angular - node (v18.10.0, x64)
  • Angular - node (v16.17.1, x64)
  • Angular - node (v14.21.3, x64)
  • Compiler-Unions - node (v18.10.0, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Compiler-Unions - node (v14.21.3, x64)
  • Monaco - node (v18.10.0, x64)
  • Monaco - node (v16.17.1, x64)
  • Monaco - node (v14.21.3, x64)
  • TFS - node (v18.10.0, x64)
  • TFS - node (v16.17.1, x64)
  • TFS - node (v14.21.3, x64)
  • material-ui - node (v18.10.0, x64)
  • material-ui - node (v16.17.1, x64)
  • material-ui - node (v14.21.3, x64)
  • xstate - node (v18.10.0, x64)
  • xstate - node (v16.17.1, x64)
  • xstate - node (v14.21.3, x64)
Benchmark Name Iterations
Current 54799 6
Baseline main 6

TSServer

Comparison Report - main..54799
Metric main 54799 Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,543ms (± 0.29%) 2,539ms (± 0.75%) ~ 2,511ms 2,560ms p=0.936 n=6
Req 2 - geterr 5,425ms (± 0.41%) 5,398ms (± 0.72%) ~ 5,348ms 5,439ms p=0.230 n=6
Req 3 - references 340ms (± 0.22%) 339ms (± 1.29%) ~ 336ms 348ms p=0.075 n=6
Req 4 - navto 289ms (± 0.40%) 291ms (± 0.59%) +2ms (+ 0.69%) 289ms 293ms p=0.040 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 75ms (± 0.68%) 76ms (± 1.08%) ~ 75ms 77ms p=0.523 n=6
CompilerTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,622ms (± 0.70%) 2,624ms (± 0.45%) ~ 2,605ms 2,639ms p=1.000 n=6
Req 2 - geterr 4,145ms (± 0.48%) 4,123ms (± 0.42%) -23ms (- 0.55%) 4,093ms 4,136ms p=0.045 n=6
Req 3 - references 351ms (± 0.71%) 350ms (± 0.75%) ~ 347ms 354ms p=0.413 n=6
Req 4 - navto 289ms (± 0.29%) 286ms (± 0.31%) -3ms (- 0.87%) 285ms 287ms p=0.007 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 80ms (± 5.24%) 79ms (± 0.70%) ~ 78ms 79ms p=0.865 n=6
xstateTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 3,086ms (± 0.59%) 3,086ms (± 0.55%) ~ 3,072ms 3,109ms p=0.872 n=6
Req 2 - geterr 1,604ms (± 0.58%) 1,670ms (± 6.73%) ~ 1,593ms 1,830ms p=1.000 n=6
Req 3 - references 116ms (± 1.06%) 113ms (± 3.64%) ~ 107ms 117ms p=0.558 n=6
Req 4 - navto 369ms (± 0.50%) 372ms (± 0.81%) ~ 368ms 375ms p=0.224 n=6
Req 5 - completionInfo count 2,872 (± 0.00%) 2,872 (± 0.00%) ~ 2,872 2,872 p=1.000 n=6
Req 5 - completionInfo 380ms (± 1.30%) 383ms (± 1.19%) ~ 378ms 391ms p=0.572 n=6
Compiler-UnionsTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,626ms (± 0.46%) 2,611ms (± 0.73%) ~ 2,592ms 2,646ms p=0.066 n=6
Req 2 - geterr 6,052ms (± 0.34%) 6,022ms (± 0.64%) ~ 5,964ms 6,080ms p=0.054 n=6
Req 3 - references 355ms (± 0.44%) 354ms (± 0.81%) ~ 349ms 357ms p=1.000 n=6
Req 4 - navto 285ms (± 0.73%) 285ms (± 1.07%) ~ 282ms 290ms p=1.000 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 83ms (± 3.21%) 82ms (± 3.61%) ~ 80ms 88ms p=0.167 n=6
CompilerTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,804ms (± 0.99%) 2,796ms (± 0.57%) ~ 2,778ms 2,822ms p=0.423 n=6
Req 2 - geterr 4,700ms (± 0.37%) 4,679ms (± 0.33%) ~ 4,663ms 4,704ms p=0.053 n=6
Req 3 - references 364ms (± 0.81%) 365ms (± 0.24%) ~ 364ms 366ms p=0.569 n=6
Req 4 - navto 283ms (± 1.45%) 281ms (± 1.32%) ~ 278ms 288ms p=0.366 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 77ms (± 0.53%) 78ms (± 4.72%) ~ 75ms 85ms p=0.528 n=6
xstateTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 3,225ms (± 0.23%) 3,219ms (± 0.16%) ~ 3,214ms 3,226ms p=0.148 n=6
Req 2 - geterr 1,763ms (± 0.66%) 1,750ms (± 1.29%) ~ 1,711ms 1,771ms p=0.423 n=6
Req 3 - references 127ms (± 6.95%) 123ms (± 1.34%) ~ 120ms 124ms p=0.096 n=6
Req 4 - navto 351ms (± 0.42%) 350ms (± 0.69%) ~ 347ms 354ms p=0.453 n=6
Req 5 - completionInfo count 2,872 (± 0.00%) 2,872 (± 0.00%) ~ 2,872 2,872 p=1.000 n=6
Req 5 - completionInfo 424ms (± 1.23%) 419ms (± 1.30%) ~ 412ms 428ms p=0.143 n=6
Compiler-UnionsTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 2,768ms (± 0.51%) 2,762ms (± 0.47%) ~ 2,744ms 2,780ms p=0.377 n=6
Req 2 - geterr 6,202ms (± 0.23%) 6,210ms (± 0.64%) ~ 6,149ms 6,257ms p=0.630 n=6
Req 3 - references 363ms (± 1.05%) 360ms (± 0.60%) ~ 358ms 364ms p=0.221 n=6
Req 4 - navto 291ms (± 0.47%) 290ms (± 0.26%) ~ 289ms 291ms p=0.437 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 101ms (± 7.37%) 99ms (± 6.19%) ~ 91ms 110ms p=1.000 n=6
CompilerTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 2,930ms (± 0.48%) 2,927ms (± 0.30%) ~ 2,916ms 2,942ms p=0.873 n=6
Req 2 - geterr 4,584ms (± 0.36%) 4,580ms (± 0.67%) ~ 4,543ms 4,629ms p=0.689 n=6
Req 3 - references 370ms (± 0.27%) 369ms (± 0.24%) ~ 368ms 370ms p=0.082 n=6
Req 4 - navto 298ms (± 0.25%) 298ms (± 0.18%) ~ 297ms 298ms p=0.476 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 84ms (± 0.89%) 83ms (± 1.45%) ~ 82ms 85ms p=0.240 n=6
xstateTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 3,485ms (± 1.49%) 3,482ms (± 0.96%) ~ 3,420ms 3,512ms p=0.575 n=6
Req 2 - geterr 1,868ms (± 0.60%) 1,859ms (± 0.75%) ~ 1,846ms 1,882ms p=0.199 n=6
Req 3 - references 135ms (± 6.41%) 150ms (± 4.98%) +15ms (+10.84%) 135ms 155ms p=0.024 n=6
Req 4 - navto 389ms (± 1.08%) 387ms (± 0.76%) ~ 385ms 393ms p=1.000 n=6
Req 5 - completionInfo count 2,872 (± 0.00%) 2,872 (± 0.00%) ~ 2,872 2,872 p=1.000 n=6
Req 5 - completionInfo 421ms (± 1.12%) 420ms (± 1.55%) ~ 410ms 428ms p=0.936 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 (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.21.3, x64)
Scenarios
  • Compiler-UnionsTSServer - node (v18.10.0, x64)
  • Compiler-UnionsTSServer - node (v16.17.1, x64)
  • Compiler-UnionsTSServer - node (v14.21.3, x64)
  • CompilerTSServer - node (v18.10.0, x64)
  • CompilerTSServer - node (v16.17.1, x64)
  • CompilerTSServer - node (v14.21.3, x64)
  • xstateTSServer - node (v18.10.0, x64)
  • xstateTSServer - node (v16.17.1, x64)
  • xstateTSServer - node (v14.21.3, x64)
Benchmark Name Iterations
Current 54799 6
Baseline main 6

Startup

Comparison Report - main..54799
Metric main 54799 Delta Best Worst p-value
tsc-startup - node (v16.17.1, x64)
Execution time 142.40ms (± 0.19%) 142.93ms (± 0.18%) +0.53ms (+ 0.37%) 141.92ms 146.71ms p=0.000 n=600
tsserver-startup - node (v16.17.1, x64)
Execution time 221.67ms (± 0.17%) 223.14ms (± 0.45%) +1.48ms (+ 0.67%) 220.81ms 233.10ms p=0.000 n=600
tsserverlibrary-startup - node (v16.17.1, x64)
Execution time 223.21ms (± 0.16%) 224.34ms (± 0.31%) +1.13ms (+ 0.50%) 222.47ms 231.03ms p=0.000 n=600
typescript-startup - node (v16.17.1, x64)
Execution time 205.41ms (± 0.18%) 206.43ms (± 0.27%) +1.02ms (+ 0.50%) 204.55ms 211.85ms p=0.000 n=600
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
  • tsc-startup - node (v16.17.1, x64)
  • tsserver-startup - node (v16.17.1, x64)
  • tsserverlibrary-startup - node (v16.17.1, x64)
  • typescript-startup - node (v16.17.1, x64)
Benchmark Name Iterations
Current 54799 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/54799/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.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

I think I understood what is going on here. At least, enough for me to make comments about function naming.

symbol = target;
}
return flags;
function getSymbolFlags(symbol: Symbol, excludeTypeOnlyMeanings?: boolean, excludeLocalMeanings?: boolean): SymbolFlags {
Copy link
Member

Choose a reason for hiding this comment

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

this name makes it sound like all uses of symbol.flags should become getSymbolFlags(symbol). Is that true? It doesn't look like it from the diff.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to audit all uses of symbol.flags when I first wrote getAllSymbolFlags and did make many substitutions. The remaining uses, as best I could tell, intentionally only look at local meanings. The name getAllSymbolFlags no longer felt appropriate with arguments that explicitly filter them down from “all.” Perhaps a way to say getSymbolFlagsIncludingNonLocalOnes would make a better name.

typeOnlyDeclarationIsExportStar
? resolveExternalModuleName(typeOnlyDeclaration.moduleSpecifier, typeOnlyDeclaration.moduleSpecifier, /*ignoreErrors*/ true)
: resolveAlias(typeOnlyDeclaration.symbol));
const typeOnlyExportStarTargets = typeOnlyDeclarationIsExportStar && typeOnlyResolution ? getExportsOfModule(typeOnlyResolution) : undefined;
Copy link
Member

Choose a reason for hiding this comment

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

This name is a little confusing since it's hard to notice that it's the exports of a module. But maybe the property that it's targets of resolution is more important.

PR Backlog automation moved this from Waiting on reviewers to Needs merge Jul 24, 2023
@andrewbranch andrewbranch merged commit 36ac4eb into main Aug 3, 2023
18 checks passed
PR Backlog automation moved this from Needs merge to Done Aug 3, 2023
@andrewbranch andrewbranch deleted the bug/54526 branch August 3, 2023 18:09
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
PR Backlog
  
Done
Development

Successfully merging this pull request may close these issues.

transpileModule: not preserving exports
4 participants