Skip to content

Fully resolve aliases when checking symbol flags #50853

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 9 commits into from
Sep 29, 2022

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Sep 19, 2022

Fixes #44896
Fixes #50455

I actually don’t think this is a breaking change in any meaningful way. I do have one test that exhibits new errors, but the scenario is extremely contrived and didn’t exactly work before. Mostly, this removes false errors and false import elisions. The most visible and understandable example is the one from #44896:

// @filename: constants.ts
export const COFFEE = 0;
export const TEA = 1;


// @filename: drink.ts
export type Drink = 0 | 1;
export * as Drink from "./constants";


// @filename: index.ts
import { Drink } from "./drink";
// 👀 BEFORE: 'Drink' only refers to a type, but is being used as a value here
// 👍 AFTER: No error
const x: Drink = Drink.TEA;

@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 Sep 19, 2022
@andrewbranch
Copy link
Member Author

@typescript-bot user test inline
@typescript-bot perf test
@typescript-bot run dt
@typescript-bot test top100

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 19, 2022

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 19, 2022

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 19, 2022

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

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

Everything looks good!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Compiler

Comparison Report - main..50853
Metric main 50853 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 363,385k (± 0.02%) 363,434k (± 0.03%) +48k (+ 0.01%) 363,247k 363,717k
Parse Time 2.09s (± 0.64%) 2.09s (± 0.67%) -0.00s (- 0.05%) 2.06s 2.12s
Bind Time 0.79s (± 0.75%) 0.79s (± 0.76%) -0.01s (- 1.01%) 0.78s 0.80s
Check Time 6.17s (± 0.32%) 6.21s (± 0.80%) +0.04s (+ 0.70%) 6.10s 6.34s
Emit Time 6.06s (± 0.91%) 6.09s (± 1.30%) +0.02s (+ 0.35%) 6.00s 6.36s
Total Time 15.12s (± 0.35%) 15.17s (± 0.83%) +0.06s (+ 0.36%) 15.00s 15.54s
Compiler-Unions - node (v10.16.3, x64)
Memory used 206,345k (± 0.05%) 206,311k (± 0.03%) -34k (- 0.02%) 206,158k 206,452k
Parse Time 0.83s (± 0.71%) 0.84s (± 0.91%) +0.00s (+ 0.24%) 0.82s 0.85s
Bind Time 0.47s (± 0.85%) 0.47s (± 1.02%) -0.00s (- 0.43%) 0.46s 0.48s
Check Time 8.40s (± 0.50%) 8.46s (± 0.74%) +0.05s (+ 0.63%) 8.34s 8.57s
Emit Time 2.46s (± 1.73%) 2.47s (± 1.94%) +0.00s (+ 0.12%) 2.38s 2.62s
Total Time 12.16s (± 0.44%) 12.22s (± 0.81%) +0.06s (+ 0.49%) 12.02s 12.41s
Monaco - node (v10.16.3, x64)
Memory used 344,772k (± 0.02%) 344,761k (± 0.01%) -11k (- 0.00%) 344,651k 344,881k
Parse Time 1.60s (± 0.81%) 1.61s (± 0.93%) +0.01s (+ 0.63%) 1.56s 1.63s
Bind Time 0.70s (± 0.92%) 0.70s (± 1.16%) +0.00s (+ 0.14%) 0.69s 0.73s
Check Time 6.19s (± 0.56%) 6.22s (± 0.55%) +0.03s (+ 0.50%) 6.17s 6.30s
Emit Time 3.24s (± 0.93%) 3.24s (± 0.99%) -0.00s (- 0.03%) 3.18s 3.31s
Total Time 11.73s (± 0.52%) 11.77s (± 0.36%) +0.04s (+ 0.37%) 11.67s 11.85s
TFS - node (v10.16.3, x64)
Memory used 306,029k (± 0.03%) 306,068k (± 0.02%) +39k (+ 0.01%) 305,883k 306,260k
Parse Time 1.28s (± 0.37%) 1.30s (± 0.59%) +0.01s (+ 0.94%) 1.28s 1.31s
Bind Time 0.67s (± 0.83%) 0.67s (± 0.83%) +0.00s (+ 0.60%) 0.66s 0.68s
Check Time 5.48s (± 0.71%) 5.49s (± 0.32%) +0.01s (+ 0.18%) 5.45s 5.52s
Emit Time 3.42s (± 1.46%) 3.38s (± 0.84%) -0.04s (- 1.11%) 3.30s 3.43s
Total Time 10.85s (± 0.57%) 10.84s (± 0.28%) -0.01s (- 0.11%) 10.78s 10.91s
material-ui - node (v10.16.3, x64)
Memory used 459,168k (± 0.01%) 459,164k (± 0.01%) -4k (- 0.00%) 459,076k 459,233k
Parse Time 1.82s (± 0.75%) 1.84s (± 0.34%) +0.02s (+ 1.32%) 1.83s 1.86s
Bind Time 0.58s (± 2.25%) 0.56s (± 0.99%) 🟩-0.02s (- 3.27%) 0.55s 0.57s
Check Time 15.49s (± 0.26%) 15.79s (± 0.97%) +0.30s (+ 1.93%) 15.51s 16.27s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 17.89s (± 0.24%) 18.19s (± 0.86%) +0.30s (+ 1.70%) 17.91s 18.67s
xstate - node (v10.16.3, x64)
Memory used 590,670k (± 1.62%) 584,366k (± 0.01%) -6,304k (- 1.07%) 584,171k 584,589k
Parse Time 2.60s (± 0.25%) 2.61s (± 0.33%) +0.01s (+ 0.38%) 2.59s 2.62s
Bind Time 0.91s (± 0.66%) 0.91s (± 0.54%) +0.01s (+ 0.99%) 0.90s 0.92s
Check Time 1.59s (± 0.19%) 1.60s (± 0.44%) +0.01s (+ 0.44%) 1.59s 1.62s
Emit Time 0.07s (± 3.14%) 0.07s (± 4.13%) +0.00s (+ 1.41%) 0.07s 0.08s
Total Time 5.16s (± 0.21%) 5.19s (± 0.21%) +0.02s (+ 0.48%) 5.16s 5.21s
Angular - node (v12.1.0, x64)
Memory used 340,740k (± 0.10%) 340,903k (± 0.02%) +163k (+ 0.05%) 340,771k 341,039k
Parse Time 2.08s (± 0.62%) 2.10s (± 0.58%) +0.02s (+ 0.91%) 2.08s 2.14s
Bind Time 0.78s (± 0.64%) 0.77s (± 0.62%) -0.00s (- 0.26%) 0.76s 0.78s
Check Time 5.85s (± 0.89%) 5.88s (± 0.32%) +0.04s (+ 0.60%) 5.85s 5.93s
Emit Time 6.33s (± 0.79%) 6.34s (± 0.40%) +0.01s (+ 0.21%) 6.30s 6.41s
Total Time 15.04s (± 0.68%) 15.10s (± 0.22%) +0.06s (+ 0.43%) 15.01s 15.16s
Compiler-Unions - node (v12.1.0, x64)
Memory used 193,708k (± 0.29%) 192,756k (± 0.62%) -952k (- 0.49%) 190,562k 194,167k
Parse Time 0.83s (± 0.87%) 0.82s (± 0.44%) -0.01s (- 0.96%) 0.82s 0.83s
Bind Time 0.48s (± 1.00%) 0.47s (± 1.04%) -0.00s (- 0.63%) 0.46s 0.48s
Check Time 6.71s (± 0.67%) 6.71s (± 0.45%) +0.00s (+ 0.01%) 6.65s 6.78s
Emit Time 2.47s (± 0.92%) 2.44s (± 1.12%) -0.03s (- 1.05%) 2.38s 2.50s
Total Time 10.49s (± 0.42%) 10.45s (± 0.27%) -0.04s (- 0.39%) 10.40s 10.52s
Monaco - node (v12.1.0, x64)
Memory used 327,690k (± 0.02%) 327,774k (± 0.02%) +85k (+ 0.03%) 327,601k 327,941k
Parse Time 1.58s (± 0.88%) 1.59s (± 0.58%) +0.01s (+ 0.57%) 1.57s 1.61s
Bind Time 0.70s (± 0.68%) 0.70s (± 0.83%) +0.01s (+ 0.86%) 0.69s 0.72s
Check Time 5.81s (± 0.46%) 5.85s (± 0.49%) +0.04s (+ 0.65%) 5.79s 5.93s
Emit Time 3.30s (± 0.68%) 3.33s (± 0.87%) +0.02s (+ 0.70%) 3.26s 3.39s
Total Time 11.39s (± 0.40%) 11.46s (± 0.42%) +0.07s (+ 0.61%) 11.38s 11.61s
TFS - node (v12.1.0, x64)
Memory used 290,648k (± 0.03%) 290,609k (± 0.07%) -39k (- 0.01%) 289,871k 290,902k
Parse Time 1.29s (± 0.85%) 1.30s (± 0.92%) +0.01s (+ 0.78%) 1.28s 1.33s
Bind Time 0.67s (± 1.40%) 0.67s (± 0.71%) 0.00s ( 0.00%) 0.66s 0.68s
Check Time 5.40s (± 0.33%) 5.44s (± 0.24%) +0.04s (+ 0.78%) 5.41s 5.48s
Emit Time 3.52s (± 0.70%) 3.54s (± 0.68%) +0.02s (+ 0.60%) 3.49s 3.61s
Total Time 10.88s (± 0.37%) 10.95s (± 0.27%) +0.07s (+ 0.64%) 10.88s 11.03s
material-ui - node (v12.1.0, x64)
Memory used 438,481k (± 0.01%) 438,186k (± 0.07%) -295k (- 0.07%) 437,282k 438,491k
Parse Time 1.83s (± 0.68%) 1.82s (± 0.55%) -0.01s (- 0.49%) 1.81s 1.86s
Bind Time 0.55s (± 1.01%) 0.55s (± 1.12%) -0.00s (- 0.54%) 0.54s 0.56s
Check Time 12.87s (± 0.73%) 12.82s (± 0.74%) -0.05s (- 0.39%) 12.65s 13.08s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.26s (± 0.63%) 15.19s (± 0.70%) -0.06s (- 0.43%) 15.02s 15.46s
xstate - node (v12.1.0, x64)
Memory used 549,341k (± 0.02%) 555,690k (± 1.68%) +6,349k (+ 1.16%) 549,282k 580,828k
Parse Time 2.55s (± 0.34%) 2.55s (± 0.56%) -0.00s (- 0.04%) 2.53s 2.58s
Bind Time 0.89s (± 0.79%) 0.89s (± 0.83%) +0.00s (+ 0.11%) 0.88s 0.91s
Check Time 1.47s (± 0.33%) 1.50s (± 0.71%) +0.02s (+ 1.49%) 1.48s 1.52s
Emit Time 0.07s (± 0.00%) 0.07s (± 0.00%) 0.00s ( 0.00%) 0.07s 0.07s
Total Time 4.99s (± 0.23%) 5.01s (± 0.35%) +0.02s (+ 0.42%) 4.95s 5.05s
Angular - node (v14.15.1, x64)
Memory used 338,956k (± 0.01%) 338,940k (± 0.01%) -16k (- 0.00%) 338,871k 339,008k
Parse Time 2.05s (± 0.67%) 2.07s (± 0.80%) +0.02s (+ 1.02%) 2.04s 2.11s
Bind Time 0.79s (± 0.43%) 0.80s (± 0.37%) +0.01s (+ 0.63%) 0.79s 0.80s
Check Time 5.86s (± 0.65%) 5.88s (± 0.69%) +0.03s (+ 0.46%) 5.80s 5.99s
Emit Time 6.23s (± 0.52%) 6.28s (± 0.42%) +0.05s (+ 0.88%) 6.19s 6.32s
Total Time 14.93s (± 0.44%) 15.04s (± 0.31%) +0.11s (+ 0.73%) 14.93s 15.14s
Compiler-Unions - node (v14.15.1, x64)
Memory used 189,996k (± 0.16%) 190,232k (± 0.02%) +237k (+ 0.12%) 190,169k 190,287k
Parse Time 0.86s (± 0.69%) 0.86s (± 0.69%) +0.00s (+ 0.00%) 0.84s 0.87s
Bind Time 0.49s (± 0.98%) 0.49s (± 0.46%) +0.00s (+ 0.41%) 0.48s 0.49s
Check Time 6.78s (± 0.58%) 6.77s (± 0.46%) -0.00s (- 0.03%) 6.71s 6.84s
Emit Time 2.42s (± 1.21%) 2.42s (± 0.89%) +0.00s (+ 0.21%) 2.38s 2.47s
Total Time 10.54s (± 0.52%) 10.54s (± 0.32%) +0.01s (+ 0.06%) 10.48s 10.61s
Monaco - node (v14.15.1, x64)
Memory used 326,540k (± 0.01%) 326,558k (± 0.01%) +18k (+ 0.01%) 326,482k 326,620k
Parse Time 1.57s (± 0.48%) 1.58s (± 0.67%) +0.01s (+ 0.64%) 1.56s 1.61s
Bind Time 0.72s (± 0.66%) 0.73s (± 1.23%) +0.00s (+ 0.41%) 0.71s 0.75s
Check Time 5.71s (± 0.48%) 5.74s (± 0.55%) +0.03s (+ 0.54%) 5.68s 5.83s
Emit Time 3.37s (± 0.58%) 3.39s (± 0.31%) +0.02s (+ 0.71%) 3.37s 3.42s
Total Time 11.38s (± 0.20%) 11.45s (± 0.30%) +0.06s (+ 0.57%) 11.38s 11.52s
TFS - node (v14.15.1, x64)
Memory used 289,652k (± 0.01%) 289,662k (± 0.00%) +10k (+ 0.00%) 289,623k 289,692k
Parse Time 1.30s (± 1.08%) 1.30s (± 0.73%) -0.01s (- 0.38%) 1.28s 1.32s
Bind Time 0.80s (± 0.83%) 0.79s (± 0.43%) -0.01s (- 0.88%) 0.79s 0.80s
Check Time 5.38s (± 0.46%) 5.41s (± 0.48%) +0.02s (+ 0.43%) 5.37s 5.48s
Emit Time 3.61s (± 0.46%) 3.61s (± 0.55%) -0.00s (- 0.11%) 3.56s 3.66s
Total Time 11.10s (± 0.36%) 11.10s (± 0.34%) +0.01s (+ 0.07%) 11.03s 11.21s
material-ui - node (v14.15.1, x64)
Memory used 436,666k (± 0.00%) 436,669k (± 0.01%) +3k (+ 0.00%) 436,605k 436,725k
Parse Time 1.88s (± 0.68%) 1.88s (± 0.66%) -0.00s (- 0.00%) 1.84s 1.90s
Bind Time 0.59s (± 1.29%) 0.59s (± 0.85%) -0.00s (- 0.17%) 0.57s 0.59s
Check Time 12.86s (± 0.46%) 12.85s (± 0.31%) -0.01s (- 0.08%) 12.79s 12.96s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.32s (± 0.45%) 15.31s (± 0.27%) -0.01s (- 0.05%) 15.25s 15.43s
xstate - node (v14.15.1, x64)
Memory used 547,046k (± 0.00%) 547,061k (± 0.00%) +15k (+ 0.00%) 547,033k 547,105k
Parse Time 2.63s (± 0.56%) 2.63s (± 0.86%) -0.01s (- 0.19%) 2.60s 2.71s
Bind Time 0.99s (± 1.23%) 0.99s (± 1.01%) +0.00s (+ 0.20%) 0.97s 1.01s
Check Time 1.52s (± 0.46%) 1.52s (± 0.82%) +0.00s (+ 0.26%) 1.50s 1.56s
Emit Time 0.07s (± 3.14%) 0.07s (± 0.00%) -0.00s (- 1.41%) 0.07s 0.07s
Total Time 5.21s (± 0.45%) 5.21s (± 0.43%) +0.00s (+ 0.04%) 5.18s 5.27s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
  • xstate - node (v10.16.3, x64)
  • xstate - node (v12.1.0, x64)
  • xstate - node (v14.15.1, x64)
Benchmark Name Iterations
Current 50853 10
Baseline main 10

TSServer

Comparison Report - main..50853
Metric main 50853 Delta Best Worst
Compiler-UnionsTSServer - node (v10.16.3, x64)
Req 1 - updateOpen 1,404ms (± 0.48%) 1,397ms (± 0.40%) -8ms (- 0.54%) 1,382ms 1,406ms
Req 2 - geterr 4,076ms (± 0.68%) 4,058ms (± 0.96%) -18ms (- 0.45%) 3,973ms 4,126ms
Req 3 - references 230ms (± 1.06%) 228ms (± 0.72%) -2ms (- 0.70%) 225ms 231ms
Req 4 - navto 172ms (± 1.28%) 172ms (± 1.50%) -0ms (- 0.06%) 167ms 177ms
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) 0 ( 0.00%) 1,356 1,356
Req 5 - completionInfo 92ms (± 2.73%) 90ms (±10.71%) -2ms (- 2.50%) 62ms 99ms
CompilerTSServer - node (v10.16.3, x64)
Req 1 - updateOpen 1,491ms (± 0.48%) 1,496ms (± 0.37%) +6ms (+ 0.38%) 1,486ms 1,506ms
Req 2 - geterr 2,258ms (± 0.37%) 2,251ms (± 0.36%) -7ms (- 0.29%) 2,234ms 2,275ms
Req 3 - references 243ms (± 0.54%) 242ms (± 0.48%) -1ms (- 0.33%) 240ms 245ms
Req 4 - navto 182ms (± 0.56%) 183ms (± 0.95%) +1ms (+ 0.61%) 178ms 185ms
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) 0 ( 0.00%) 1,518 1,518
Req 5 - completionInfo 61ms (± 1.65%) 62ms (± 2.93%) +1ms (+ 1.81%) 59ms 68ms
xstateTSServer - node (v10.16.3, x64)
Req 1 - updateOpen 2,083ms (± 0.49%) 2,080ms (± 0.40%) -4ms (- 0.19%) 2,050ms 2,096ms
Req 2 - geterr 797ms (± 0.47%) 796ms (± 0.24%) -1ms (- 0.14%) 791ms 799ms
Req 3 - references 96ms (± 1.48%) 97ms (± 2.06%) +1ms (+ 0.62%) 94ms 102ms
Req 4 - navto 231ms (± 0.90%) 231ms (± 0.74%) +1ms (+ 0.26%) 228ms 234ms
Req 5 - completionInfo count 3,301 (± 0.00%) 3,301 (± 0.00%) 0 ( 0.00%) 3,301 3,301
Req 5 - completionInfo 280ms (± 1.07%) 280ms (± 0.66%) -0ms (- 0.07%) 277ms 284ms
Compiler-UnionsTSServer - node (v12.1.0, x64)
Req 1 - updateOpen 1,421ms (± 0.75%) 1,419ms (± 0.72%) -2ms (- 0.13%) 1,403ms 1,447ms
Req 2 - geterr 3,408ms (± 0.40%) 3,404ms (± 0.57%) -3ms (- 0.10%) 3,354ms 3,432ms
Req 3 - references 223ms (± 1.61%) 220ms (± 0.73%) -3ms (- 1.30%) 217ms 224ms
Req 4 - navto 161ms (± 1.06%) 162ms (± 1.44%) +1ms (+ 0.37%) 157ms 167ms
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) 0 ( 0.00%) 1,356 1,356
Req 5 - completionInfo 61ms (± 3.55%) 64ms (± 4.16%) +3ms (+ 4.74%) 58ms 69ms
CompilerTSServer - node (v12.1.0, x64)
Req 1 - updateOpen 1,512ms (± 0.55%) 1,500ms (± 0.55%) -12ms (- 0.77%) 1,481ms 1,523ms
Req 2 - geterr 2,181ms (± 0.55%) 2,182ms (± 0.55%) +1ms (+ 0.03%) 2,155ms 2,211ms
Req 3 - references 236ms (± 0.51%) 235ms (± 0.98%) -1ms (- 0.38%) 231ms 242ms
Req 4 - navto 171ms (± 1.03%) 171ms (± 0.70%) +0ms (+ 0.18%) 168ms 173ms
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) 0 ( 0.00%) 1,518 1,518
Req 5 - completionInfo 63ms (± 2.73%) 61ms (± 3.74%) 🟩-2ms (- 3.63%) 58ms 69ms
xstateTSServer - node (v12.1.0, x64)
Req 1 - updateOpen 2,053ms (± 0.64%) 2,056ms (± 0.31%) +3ms (+ 0.16%) 2,044ms 2,071ms
Req 2 - geterr 752ms (± 0.94%) 759ms (± 0.60%) +6ms (+ 0.82%) 749ms 771ms
Req 3 - references 68ms (± 1.45%) 68ms (± 1.07%) +0ms (+ 0.59%) 67ms 70ms
Req 4 - navto 225ms (± 0.71%) 227ms (± 1.39%) +1ms (+ 0.53%) 215ms 230ms
Req 5 - completionInfo count 3,301 (± 0.00%) 3,301 (± 0.00%) 0 ( 0.00%) 3,301 3,301
Req 5 - completionInfo 276ms (± 0.29%) 278ms (± 1.54%) +3ms (+ 0.91%) 272ms 294ms
Compiler-UnionsTSServer - node (v14.15.1, x64)
Req 1 - updateOpen 1,453ms (± 0.56%) 1,451ms (± 0.50%) -2ms (- 0.12%) 1,433ms 1,464ms
Req 2 - geterr 3,505ms (± 0.58%) 3,535ms (± 1.00%) +30ms (+ 0.86%) 3,471ms 3,619ms
Req 3 - references 230ms (± 0.66%) 230ms (± 0.71%) 0ms ( 0.00%) 225ms 233ms
Req 4 - navto 170ms (± 0.65%) 170ms (± 0.81%) -0ms (- 0.06%) 167ms 172ms
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) 0 ( 0.00%) 1,356 1,356
Req 5 - completionInfo 55ms (± 2.82%) 56ms (± 2.34%) +1ms (+ 1.08%) 54ms 60ms
CompilerTSServer - node (v14.15.1, x64)
Req 1 - updateOpen 1,521ms (± 0.32%) 1,526ms (± 0.54%) +5ms (+ 0.32%) 1,502ms 1,542ms
Req 2 - geterr 2,299ms (± 0.20%) 2,307ms (± 0.43%) +8ms (+ 0.33%) 2,280ms 2,333ms
Req 3 - references 242ms (± 0.75%) 241ms (± 0.63%) -1ms (- 0.29%) 238ms 244ms
Req 4 - navto 177ms (± 0.55%) 177ms (± 0.60%) +0ms (+ 0.17%) 175ms 179ms
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) 0 ( 0.00%) 1,518 1,518
Req 5 - completionInfo 55ms (± 2.00%) 55ms (± 0.87%) -0ms (- 0.55%) 54ms 56ms
xstateTSServer - node (v14.15.1, x64)
Req 1 - updateOpen 2,155ms (± 0.27%) 2,152ms (± 0.40%) -2ms (- 0.11%) 2,136ms 2,170ms
Req 2 - geterr 769ms (± 0.59%) 769ms (± 0.38%) -0ms (- 0.01%) 762ms 775ms
Req 3 - references 68ms (± 1.70%) 68ms (± 1.61%) +0ms (+ 0.15%) 66ms 71ms
Req 4 - navto 229ms (± 0.53%) 230ms (± 0.52%) +1ms (+ 0.26%) 227ms 232ms
Req 5 - completionInfo count 3,301 (± 0.00%) 3,301 (± 0.00%) 0 ( 0.00%) 3,301 3,301
Req 5 - completionInfo 289ms (± 4.12%) 280ms (± 1.28%) 🟩-9ms (- 3.15%) 273ms 287ms
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Compiler-UnionsTSServer - node (v10.16.3, x64)
  • Compiler-UnionsTSServer - node (v12.1.0, x64)
  • Compiler-UnionsTSServer - node (v14.15.1, x64)
  • CompilerTSServer - node (v10.16.3, x64)
  • CompilerTSServer - node (v12.1.0, x64)
  • CompilerTSServer - node (v14.15.1, x64)
  • xstateTSServer - node (v10.16.3, x64)
  • xstateTSServer - node (v12.1.0, x64)
  • xstateTSServer - node (v14.15.1, x64)
Benchmark Name Iterations
Current 50853 10
Baseline main 10

Developer Information:

Download Benchmark


==== tests/cases/conformance/externalModules/a.ts (0 errors) ====
function A() {}
export type { A };
Copy link
Member

Choose a reason for hiding this comment

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

Why is this not an error? Since we're exporting as type-only something that is not a type.

Copy link
Member Author

Choose a reason for hiding this comment

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

Someone who imports this is allowed to use type ASignature = typeof A

export const displayName = "A";
}

A();
Copy link
Member

Choose a reason for hiding this comment

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

to check my own understanding, this is an error because we don't allow the function value to merge with the namespace?

Copy link
Member Author

Choose a reason for hiding this comment

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

That’s right, but only because A is an alias. Normally, slightly disconcerting though it is, we allow a function to merge with an instantiated namespace: playground. I only learned this in the course of my PR, but the rules are stricter for merges across module boundaries (thankfully). Two values are just not allowed to merge across modules.

@@ -2225,8 +2225,8 @@ namespace ts {
!checkAndReportErrorForExtendingInterface(errorLocation) &&
!checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
!checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
!checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) &&
Copy link
Member

Choose a reason for hiding this comment

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

I think that's covered in the tests, but what's the consequence of changing this check's order?

Copy link
Member Author

Choose a reason for hiding this comment

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

It’s been a while, but I believe it’s this:

A namespace is a value if it exports values. If it’s not a value, it’s not a type per se, but it’s fairly typey. I believe after tweaking the meaning flag checks in these functions to be a bit easier to read, the checkAndReportErrorForUsingTypeAsValue started reporting an error on typey (uninstantiated) namespaces, which was stepping on the toes of checkAndReportErrorForUsingNamespaceModuleAsValue, which wanted to issue essentially the same error, but slightly more precise in mentioning that the non-valuey thing is a namespace. So I simply moved that check first so it would take precedence. So I actually think this order change isn’t reflected in the tests, because it just neutralizes the effect of another readability change. (I also renamed checkAndReportErrorForUsingNamespaceModuleAsValue to checkAndReportErrorForUsingNamespaceAsTypeOrValue because nobody knows what a “namespace module” is, and it was already issuing errors when using a namespace as a type.)

@andrewbranch
Copy link
Member Author

@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 29, 2022

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - main..50853

Metric main 50853 Delta Best Worst
Angular - node (v14.15.1, x64)
Memory used 338,132k (± 0.01%) 338,110k (± 0.01%) -23k (- 0.01%) 338,049k 338,150k
Parse Time 2.06s (± 0.62%) 2.05s (± 0.56%) -0.01s (- 0.53%) 2.03s 2.08s
Bind Time 0.80s (± 0.94%) 0.79s (± 0.70%) -0.01s (- 0.63%) 0.78s 0.80s
Check Time 5.89s (± 0.46%) 5.88s (± 0.50%) -0.00s (- 0.07%) 5.82s 5.94s
Emit Time 6.29s (± 0.66%) 6.26s (± 0.54%) -0.03s (- 0.46%) 6.20s 6.35s
Total Time 15.03s (± 0.44%) 14.99s (± 0.33%) -0.05s (- 0.31%) 14.89s 15.07s
Compiler-Unions - node (v14.15.1, x64)
Memory used 190,220k (± 0.01%) 190,803k (± 0.68%) +584k (+ 0.31%) 190,156k 196,015k
Parse Time 0.86s (± 0.68%) 0.85s (± 0.47%) -0.01s (- 0.70%) 0.84s 0.86s
Bind Time 0.48s (± 0.70%) 0.48s (± 1.02%) +0.00s (+ 0.21%) 0.48s 0.50s
Check Time 6.75s (± 0.75%) 6.73s (± 0.31%) -0.02s (- 0.24%) 6.67s 6.77s
Emit Time 2.40s (± 0.53%) 2.40s (± 0.46%) -0.00s (- 0.13%) 2.38s 2.42s
Total Time 10.49s (± 0.57%) 10.47s (± 0.27%) -0.02s (- 0.20%) 10.39s 10.52s
Monaco - node (v14.15.1, x64)
Memory used 326,575k (± 0.01%) 326,580k (± 0.01%) +5k (+ 0.00%) 326,526k 326,641k
Parse Time 1.59s (± 0.90%) 1.59s (± 0.66%) +0.00s (+ 0.13%) 1.57s 1.62s
Bind Time 0.73s (± 1.39%) 0.73s (± 0.94%) -0.00s (- 0.00%) 0.72s 0.75s
Check Time 5.74s (± 0.47%) 5.72s (± 0.52%) -0.02s (- 0.33%) 5.67s 5.80s
Emit Time 3.37s (± 0.54%) 3.36s (± 0.56%) -0.01s (- 0.39%) 3.31s 3.40s
Total Time 11.42s (± 0.42%) 11.39s (± 0.40%) -0.03s (- 0.25%) 11.28s 11.50s
TFS - node (v14.15.1, x64)
Memory used 289,682k (± 0.00%) 289,706k (± 0.01%) +24k (+ 0.01%) 289,635k 289,757k
Parse Time 1.29s (± 0.72%) 1.29s (± 0.81%) +0.00s (+ 0.16%) 1.28s 1.32s
Bind Time 0.80s (± 0.62%) 0.79s (± 0.75%) -0.00s (- 0.25%) 0.78s 0.81s
Check Time 5.39s (± 0.40%) 5.39s (± 0.36%) -0.00s (- 0.04%) 5.36s 5.44s
Emit Time 3.60s (± 0.89%) 3.62s (± 0.55%) +0.02s (+ 0.58%) 3.58s 3.68s
Total Time 11.07s (± 0.45%) 11.09s (± 0.21%) +0.02s (+ 0.19%) 11.05s 11.15s
material-ui - node (v14.15.1, x64)
Memory used 435,617k (± 0.00%) 435,528k (± 0.04%) -90k (- 0.02%) 434,900k 435,655k
Parse Time 1.87s (± 0.44%) 1.88s (± 0.53%) +0.01s (+ 0.37%) 1.86s 1.90s
Bind Time 0.58s (± 0.81%) 0.58s (± 0.69%) +0.00s (+ 0.17%) 0.57s 0.59s
Check Time 12.88s (± 0.41%) 12.90s (± 0.72%) +0.02s (+ 0.16%) 12.70s 13.13s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.32s (± 0.38%) 15.35s (± 0.58%) +0.03s (+ 0.20%) 15.14s 15.57s
xstate - node (v14.15.1, x64)
Memory used 544,080k (± 0.00%) 544,094k (± 0.00%) +14k (+ 0.00%) 544,063k 544,134k
Parse Time 2.62s (± 0.36%) 2.61s (± 0.62%) -0.00s (- 0.08%) 2.59s 2.67s
Bind Time 0.98s (± 1.32%) 0.97s (± 0.46%) -0.01s (- 1.22%) 0.96s 0.98s
Check Time 1.51s (± 0.44%) 1.51s (± 0.44%) -0.00s (- 0.20%) 1.50s 1.53s
Emit Time 0.07s (± 0.00%) 0.07s (± 3.14%) +0.00s (+ 1.43%) 0.07s 0.08s
Total Time 5.19s (± 0.27%) 5.17s (± 0.33%) -0.01s (- 0.27%) 5.15s 5.23s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v14.15.1, x64)
  • xstate - node (v14.15.1, x64)
Benchmark Name Iterations
Current 50853 10
Baseline main 10

Developer Information:

Download Benchmark

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.

LGTM, though I'm not sure I'm a massive fan of the ?? -1; it seems like most call sites do that but I don't know if I have any better method, besides maybe SymbolFlags.All or something, but that still requires the ??.

@andrewbranch
Copy link
Member Author

I might look at making getAllSymbolFlags opinionated and say that unresolved aliases return SymbolFlags.All, and make a variant that returns undefined for the few places that need to do something different. I think it’s probable that a lot of the places that currently see SymbolFlags.Property would have the same behavior seeing SymbolFlags.All.

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.

When aliases and local declarations merge, basically nothing works export * as X cannot be imported when type X is exported
5 participants