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

add pushTypeResolution to getTypeOfAlias #52642

Merged
merged 35 commits into from
Oct 28, 2023
Merged

Conversation

iisaduan
Copy link
Member

@iisaduan iisaduan commented Feb 6, 2023

Fixes #50928

@typescript-bot typescript-bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Feb 6, 2023
@DanielRosenwasser
Copy link
Member

Shouldn't every call to pushTypeResolution be accompanied by a subsequent popTypeResolution?

@jakebailey
Copy link
Member

That being said, all of the other pops appear to have specific error messages, so we probably will need one for this case (if it ends up fixing the bug).

src/compiler/checker.ts Outdated Show resolved Hide resolved
Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

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

This is probably the right fix, but we should just make this a plain compiler test.

tests/cases/fourslash/pushTypeGetTypeOfAlias.ts Outdated Show resolved Hide resolved
@DanielRosenwasser
Copy link
Member

It is sort of funny that there's a comment in the middle of this function:

            // It only makes sense to get the type of a value symbol. If the result of resolving
            // the alias is not a value, then it has no type. To get the type associated with a
            // type symbol, call getDeclaredTypeOfSymbol.
            // This check is important because without it, a call to getTypeOfSymbol could end
            // up recursively calling getTypeOfAlias, causing a stack overflow.

And the specific thing going wrong here is that getTypeOfSymbol ends up recursively calling getTypeOfAlias, causing a stack overflow. So I wonder if the appropriate fix here is really to plug into pushTypeResolution, or if it's another special case..

@iisaduan
Copy link
Member Author

iisaduan commented Feb 9, 2023

It is sort of funny that there's a comment in the middle of this function:

            // It only makes sense to get the type of a value symbol. If the result of resolving
            // the alias is not a value, then it has no type. To get the type associated with a
            // type symbol, call getDeclaredTypeOfSymbol.
            // This check is important because without it, a call to getTypeOfSymbol could end
            // up recursively calling getTypeOfAlias, causing a stack overflow.

And the specific thing going wrong here is that getTypeOfSymbol ends up recursively calling getTypeOfAlias, causing a stack overflow. So I wonder if the appropriate fix here is really to plug into pushTypeResolution, or if it's another special case..

There's also

// Anonymous types without a symbol are never circular.

commented in createAnonymousTypeNode, in the else block that the stack overflow loop takes.

src/compiler/checker.ts Outdated Show resolved Hide resolved
tests/baselines/reference/pushTypeGetTypeOfAlias.types Outdated Show resolved Hide resolved
@typescript-bot
Copy link
Collaborator

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

There were infrastructure failures potentially unrelated to your change:

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

Otherwise...

Everything looks good!

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top-repos suite comparing main and refs/pull/52642/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.

@typescript-bot
Copy link
Collaborator

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

Everything looks good!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Compiler

Comparison Report - main..52642
Metric main 52642 Delta Best Worst p-value
Angular - node (v18.10.0, x64)
Memory used 365,801k (± 0.01%) 365,797k (± 0.00%) ~ 365,774k 365,807k p=0.810 n=6
Parse Time 3.42s (± 0.89%) 3.41s (± 0.48%) ~ 3.39s 3.43s p=0.572 n=6
Bind Time 1.12s (± 0.46%) 1.12s (± 0.92%) ~ 1.11s 1.13s p=0.793 n=6
Check Time 8.76s (± 0.67%) 8.76s (± 0.60%) ~ 8.69s 8.83s p=1.000 n=6
Emit Time 7.40s (± 0.40%) 7.44s (± 0.76%) ~ 7.38s 7.53s p=0.226 n=6
Total Time 20.70s (± 0.37%) 20.72s (± 0.49%) ~ 20.62s 20.88s p=0.688 n=6
Compiler-Unions - node (v18.10.0, x64)
Memory used 193,008k (± 1.49%) 193,024k (± 1.51%) ~ 191,122k 196,789k p=0.810 n=6
Parse Time 1.50s (± 0.78%) 1.51s (± 0.91%) ~ 1.50s 1.54s p=0.054 n=6
Bind Time 0.77s (± 0.53%) 0.77s (± 0.97%) ~ 0.76s 0.78s p=0.389 n=6
Check Time 9.48s (± 0.43%) 9.49s (± 0.71%) ~ 9.39s 9.54s p=0.332 n=6
Emit Time 2.74s (± 0.54%) 2.74s (± 1.04%) ~ 2.69s 2.77s p=1.000 n=6
Total Time 14.49s (± 0.30%) 14.52s (± 0.54%) ~ 14.41s 14.59s p=0.467 n=6
Monaco - node (v18.10.0, x64)
Memory used 346,614k (± 0.01%) 346,632k (± 0.01%) ~ 346,585k 346,675k p=0.336 n=6
Parse Time 2.59s (± 0.40%) 2.58s (± 0.94%) ~ 2.56s 2.62s p=0.373 n=6
Bind Time 1.00s (± 0.63%) 1.01s (± 0.75%) ~ 1.00s 1.02s p=0.081 n=6
Check Time 7.14s (± 0.77%) 7.15s (± 0.76%) ~ 7.09s 7.24s p=0.572 n=6
Emit Time 4.24s (± 0.35%) 4.23s (± 0.67%) ~ 4.20s 4.28s p=0.253 n=6
Total Time 14.97s (± 0.42%) 14.98s (± 0.29%) ~ 14.91s 15.02s p=0.686 n=6
TFS - node (v18.10.0, x64)
Memory used 300,606k (± 0.01%) 300,604k (± 0.01%) ~ 300,576k 300,635k p=0.810 n=6
Parse Time 2.06s (± 1.74%) 2.06s (± 0.85%) ~ 2.03s 2.08s p=0.566 n=6
Bind Time 1.13s (± 1.48%) 1.14s (± 0.96%) ~ 1.12s 1.15s p=0.247 n=6
Check Time 6.61s (± 0.64%) 6.63s (± 0.50%) ~ 6.59s 6.67s p=0.517 n=6
Emit Time 3.90s (± 0.48%) 3.89s (± 0.74%) ~ 3.84s 3.91s p=0.686 n=6
Total Time 13.70s (± 0.71%) 13.72s (± 0.47%) ~ 13.61s 13.80s p=0.688 n=6
material-ui - node (v18.10.0, x64)
Memory used 481,732k (± 0.01%) 481,731k (± 0.01%) ~ 481,653k 481,837k p=1.000 n=6
Parse Time 3.10s (± 0.33%) 3.11s (± 1.08%) ~ 3.06s 3.14s p=0.567 n=6
Bind Time 0.92s (± 0.60%) 0.90s (± 1.52%) ~ 0.89s 0.92s p=0.235 n=6
Check Time 16.78s (± 0.71%) 16.79s (± 0.40%) ~ 16.70s 16.86s 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 20.80s (± 0.60%) 20.81s (± 0.42%) ~ 20.72s 20.93s p=1.000 n=6
xstate - node (v18.10.0, x64)
Memory used 563,085k (± 0.01%) 563,051k (± 0.02%) ~ 562,888k 563,275k p=0.470 n=6
Parse Time 3.82s (± 0.72%) 3.83s (± 0.57%) ~ 3.79s 3.85s p=0.327 n=6
Bind Time 1.63s (± 0.51%) 1.63s (± 0.60%) ~ 1.62s 1.64s p=0.209 n=6
Check Time 2.83s (± 0.83%) 2.81s (± 0.58%) ~ 2.78s 2.82s p=0.073 n=6
Emit Time 0.08s (± 0.00%) 0.08s (± 0.00%) ~ 0.08s 0.08s p=1.000 n=6
Total Time 8.36s (± 0.45%) 8.35s (± 0.27%) ~ 8.33s 8.39s p=0.809 n=6
Angular - node (v16.17.1, x64)
Memory used 365,201k (± 0.01%) 365,203k (± 0.01%) ~ 365,164k 365,239k p=0.810 n=6
Parse Time 3.55s (± 0.21%) 3.56s (± 0.39%) +0.02s (+ 0.47%) 3.55s 3.58s p=0.045 n=6
Bind Time 1.18s (± 0.99%) 1.18s (± 0.88%) ~ 1.17s 1.20s p=0.406 n=6
Check Time 9.56s (± 0.29%) 9.60s (± 0.36%) ~ 9.56s 9.66s p=0.102 n=6
Emit Time 7.92s (± 0.31%) 7.96s (± 0.81%) ~ 7.88s 8.02s p=0.572 n=6
Total Time 22.21s (± 0.26%) 22.31s (± 0.43%) ~ 22.18s 22.39s p=0.106 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 192,863k (± 0.11%) 192,860k (± 0.07%) ~ 192,597k 192,998k p=0.423 n=6
Parse Time 1.60s (± 0.92%) 1.61s (± 0.75%) ~ 1.59s 1.62s p=0.325 n=6
Bind Time 0.83s (± 0.62%) 0.83s (± 0.62%) ~ 0.82s 0.83s p=1.000 n=6
Check Time 10.21s (± 0.72%) 10.23s (± 0.70%) ~ 10.13s 10.34s p=0.873 n=6
Emit Time 3.01s (± 0.50%) 3.05s (± 3.57%) ~ 2.99s 3.27s p=0.742 n=6
Total Time 15.65s (± 0.48%) 15.71s (± 0.93%) ~ 15.57s 15.96s p=0.469 n=6
Monaco - node (v16.17.1, x64)
Memory used 345,871k (± 0.00%) 345,882k (± 0.01%) ~ 345,864k 345,911k p=0.378 n=6
Parse Time 2.73s (± 0.36%) 2.72s (± 0.33%) ~ 2.71s 2.73s p=0.070 n=6
Bind Time 1.09s (± 0.47%) 1.09s (± 1.11%) ~ 1.07s 1.10s p=1.000 n=6
Check Time 7.83s (± 0.31%) 7.85s (± 0.42%) ~ 7.81s 7.89s p=0.421 n=6
Emit Time 4.45s (± 0.63%) 4.47s (± 0.46%) ~ 4.44s 4.50s p=0.293 n=6
Total Time 16.10s (± 0.27%) 16.13s (± 0.36%) ~ 16.05s 16.18s p=0.421 n=6
TFS - node (v16.17.1, x64)
Memory used 299,962k (± 0.01%) 299,961k (± 0.01%) ~ 299,928k 299,987k p=0.873 n=6
Parse Time 2.17s (± 0.69%) 2.17s (± 0.64%) ~ 2.15s 2.19s p=0.622 n=6
Bind Time 1.24s (± 1.02%) 1.23s (± 0.80%) ~ 1.22s 1.24s p=0.214 n=6
Check Time 7.28s (± 0.54%) 7.28s (± 0.43%) ~ 7.24s 7.32s p=0.935 n=6
Emit Time 4.34s (± 0.55%) 4.33s (± 0.95%) ~ 4.28s 4.38s p=0.935 n=6
Total Time 15.02s (± 0.42%) 15.01s (± 0.54%) ~ 14.90s 15.11s p=0.748 n=6
material-ui - node (v16.17.1, x64)
Memory used 480,980k (± 0.01%) 480,984k (± 0.00%) ~ 480,965k 480,999k p=0.688 n=6
Parse Time 3.25s (± 0.45%) 3.24s (± 0.44%) ~ 3.22s 3.26s p=0.243 n=6
Bind Time 0.94s (± 0.80%) 0.94s (± 0.43%) ~ 0.94s 0.95s p=0.389 n=6
Check Time 17.79s (± 0.42%) 17.81s (± 0.68%) ~ 17.68s 18.00s 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 21.98s (± 0.34%) 21.99s (± 0.58%) ~ 21.85s 22.19s p=0.873 n=6
xstate - node (v16.17.1, x64)
Memory used 560,635k (± 0.02%) 560,679k (± 0.03%) ~ 560,513k 560,947k p=0.810 n=6
Parse Time 4.00s (± 0.58%) 3.99s (± 0.25%) ~ 3.97s 4.00s p=0.250 n=6
Bind Time 1.76s (± 0.69%) 1.76s (± 0.23%) ~ 1.76s 1.77s p=0.498 n=6
Check Time 3.07s (± 0.50%) 3.06s (± 0.38%) ~ 3.04s 3.07s p=0.251 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 5.53%) ~ 0.09s 0.10s p=0.174 n=6
Total Time 8.93s (± 0.44%) 8.91s (± 0.17%) ~ 8.89s 8.93s p=0.332 n=6
Angular - node (v14.21.3, x64)
Memory used 359,213k (± 0.01%) 359,215k (± 0.00%) ~ 359,188k 359,237k p=1.000 n=6
Parse Time 3.67s (± 0.44%) 3.68s (± 0.49%) ~ 3.66s 3.71s p=0.684 n=6
Bind Time 1.22s (± 0.45%) 1.22s (± 0.62%) ~ 1.21s 1.23s p=0.476 n=6
Check Time 10.00s (± 0.30%) 10.01s (± 0.43%) ~ 9.96s 10.07s p=0.808 n=6
Emit Time 8.34s (± 1.21%) 8.35s (± 0.19%) ~ 8.33s 8.37s p=0.377 n=6
Total Time 23.23s (± 0.60%) 23.27s (± 0.20%) ~ 23.22s 23.35s p=0.335 n=6
Compiler-Unions - node (v14.21.3, x64)
Memory used 188,287k (± 0.01%) 188,273k (± 0.01%) ~ 188,238k 188,301k p=0.378 n=6
Parse Time 1.61s (± 0.85%) 1.61s (± 0.47%) ~ 1.60s 1.62s p=0.437 n=6
Bind Time 0.85s (± 0.74%) 0.85s (± 0.61%) ~ 0.84s 0.85s p=0.386 n=6
Check Time 10.31s (± 0.40%) 10.28s (± 0.42%) ~ 10.24s 10.34s p=0.170 n=6
Emit Time 3.13s (± 0.78%) 3.13s (± 0.77%) ~ 3.10s 3.17s p=0.934 n=6
Total Time 15.91s (± 0.42%) 15.87s (± 0.41%) ~ 15.78s 15.93s p=0.295 n=6
Monaco - node (v14.21.3, x64)
Memory used 341,012k (± 0.01%) 341,027k (± 0.00%) ~ 341,011k 341,044k p=0.261 n=6
Parse Time 2.80s (± 0.49%) 2.80s (± 0.49%) ~ 2.79s 2.83s p=0.678 n=6
Bind Time 1.11s (± 0.46%) 1.11s (± 0.37%) ~ 1.11s 1.12s p=0.595 n=6
Check Time 8.19s (± 0.53%) 8.18s (± 0.40%) ~ 8.14s 8.22s p=0.808 n=6
Emit Time 4.71s (± 0.58%) 4.69s (± 0.65%) ~ 4.64s 4.72s p=0.327 n=6
Total Time 16.82s (± 0.41%) 16.78s (± 0.13%) ~ 16.74s 16.80s p=0.259 n=6
TFS - node (v14.21.3, x64)
Memory used 295,134k (± 0.00%) 295,142k (± 0.00%) ~ 295,132k 295,147k p=0.423 n=6
Parse Time 2.40s (± 0.67%) 2.39s (± 0.73%) ~ 2.37s 2.42s p=0.548 n=6
Bind Time 1.07s (± 0.51%) 1.07s (± 0.51%) ~ 1.06s 1.07s p=1.000 n=6
Check Time 7.60s (± 0.51%) 7.60s (± 0.61%) ~ 7.52s 7.64s p=1.000 n=6
Emit Time 4.33s (± 0.74%) 4.32s (± 0.61%) ~ 4.30s 4.37s p=0.628 n=6
Total Time 15.40s (± 0.35%) 15.38s (± 0.46%) ~ 15.29s 15.47s p=0.748 n=6
material-ui - node (v14.21.3, x64)
Memory used 476,551k (± 0.00%) 476,550k (± 0.01%) ~ 476,487k 476,594k p=0.575 n=6
Parse Time 3.35s (± 0.69%) 3.34s (± 0.99%) ~ 3.30s 3.40s p=0.418 n=6
Bind Time 1.00s (± 0.75%) 1.00s (± 0.51%) ~ 1.00s 1.01s p=0.241 n=6
Check Time 18.79s (± 0.52%) 18.76s (± 1.01%) ~ 18.55s 18.95s 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 23.14s (± 0.41%) 23.10s (± 0.86%) ~ 22.88s 23.36s p=0.688 n=6
xstate - node (v14.21.3, x64)
Memory used 549,597k (± 0.00%) 549,582k (± 0.00%) ~ 549,562k 549,603k p=0.128 n=6
Parse Time 4.27s (± 0.76%) 4.27s (± 1.48%) ~ 4.21s 4.39s p=0.467 n=6
Bind Time 1.63s (± 2.75%) 1.60s (± 2.85%) ~ 1.56s 1.69s p=0.221 n=6
Check Time 3.19s (± 0.88%) 3.16s (± 0.86%) ~ 3.12s 3.19s p=0.128 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 4.45%) ~ 0.09s 0.10s p=0.405 n=6
Total Time 9.18s (± 0.31%) 9.12s (± 0.58%) -0.07s (- 0.73%) 9.04s 9.17s p=0.030 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 52642 6
Baseline main 6

TSServer

Comparison Report - main..52642
Metric main 52642 Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,542ms (± 0.56%) 2,538ms (± 0.57%) ~ 2,523ms 2,564ms p=0.575 n=6
Req 2 - geterr 5,524ms (± 1.56%) 5,587ms (± 0.62%) ~ 5,541ms 5,633ms p=0.149 n=6
Req 3 - references 337ms (± 0.96%) 336ms (± 0.71%) ~ 332ms 339ms p=0.934 n=6
Req 4 - navto 286ms (± 0.79%) 288ms (± 1.58%) ~ 284ms 295ms p=0.189 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 86ms (± 0.98%) 85ms (± 1.49%) ~ 84ms 87ms p=0.356 n=6
CompilerTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,657ms (± 0.32%) 2,658ms (± 0.93%) ~ 2,635ms 2,706ms p=0.294 n=6
Req 2 - geterr 4,280ms (± 0.45%) 4,303ms (± 0.34%) ~ 4,287ms 4,319ms p=0.066 n=6
Req 3 - references 348ms (± 0.72%) 350ms (± 0.43%) ~ 348ms 352ms p=0.125 n=6
Req 4 - navto 292ms (± 0.40%) 292ms (± 1.11%) ~ 289ms 298ms p=0.565 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 64ms (± 4.66%) 65ms (± 5.85%) ~ 62ms 70ms p=0.868 n=6
xstateTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 3,070ms (± 0.50%) 3,080ms (± 0.55%) ~ 3,056ms 3,100ms p=0.378 n=6
Req 2 - geterr 1,570ms (± 1.24%) 1,590ms (± 0.82%) ~ 1,574ms 1,613ms p=0.065 n=6
Req 3 - references 114ms (± 1.63%) 114ms (± 1.21%) ~ 112ms 116ms p=0.288 n=6
Req 4 - navto 359ms (± 0.38%) 359ms (± 0.61%) ~ 357ms 363ms p=0.932 n=6
Req 5 - completionInfo count 2,862 (± 0.00%) 2,862 (± 0.00%) ~ 2,862 2,862 p=1.000 n=6
Req 5 - completionInfo 378ms (± 1.37%) 376ms (± 1.59%) ~ 366ms 382ms p=0.629 n=6
Compiler-UnionsTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,660ms (± 0.64%) 2,679ms (± 0.96%) ~ 2,652ms 2,725ms p=0.336 n=6
Req 2 - geterr 6,037ms (± 0.49%) 5,967ms (± 2.20%) ~ 5,702ms 6,045ms p=0.298 n=6
Req 3 - references 351ms (± 1.38%) 353ms (± 0.30%) ~ 351ms 354ms p=0.102 n=6
Req 4 - navto 291ms (± 1.72%) 289ms (± 1.79%) ~ 281ms 296ms p=0.808 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 91ms (± 5.10%) 90ms (± 5.94%) ~ 79ms 93ms p=0.618 n=6
CompilerTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,831ms (± 0.78%) 2,837ms (± 0.50%) ~ 2,816ms 2,856ms p=0.688 n=6
Req 2 - geterr 4,646ms (± 0.47%) 4,659ms (± 0.37%) ~ 4,636ms 4,685ms p=0.471 n=6
Req 3 - references 363ms (± 0.73%) 367ms (± 0.29%) ~ 365ms 368ms p=0.061 n=6
Req 4 - navto 285ms (± 0.91%) 287ms (± 0.81%) ~ 285ms 291ms p=0.213 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 68ms (± 1.11%) 67ms (± 0.77%) ~ 67ms 68ms p=0.247 n=6
xstateTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 3,205ms (± 0.29%) 3,218ms (± 0.52%) ~ 3,199ms 3,240ms p=0.128 n=6
Req 2 - geterr 1,744ms (± 0.87%) 1,739ms (± 0.48%) ~ 1,724ms 1,748ms p=0.687 n=6
Req 3 - references 123ms (± 1.23%) 129ms (± 7.99%) ~ 120ms 144ms p=0.250 n=6
Req 4 - navto 342ms (± 0.68%) 344ms (± 1.08%) ~ 339ms 348ms p=0.373 n=6
Req 5 - completionInfo count 2,862 (± 0.00%) 2,862 (± 0.00%) ~ 2,862 2,862 p=1.000 n=6
Req 5 - completionInfo 406ms (± 2.36%) 410ms (± 2.25%) ~ 392ms 416ms p=0.520 n=6
Compiler-UnionsTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 2,787ms (± 0.48%) 2,806ms (± 0.22%) +19ms (+ 0.68%) 2,795ms 2,813ms p=0.030 n=6
Req 2 - geterr 6,188ms (± 0.65%) 6,185ms (± 0.48%) ~ 6,144ms 6,223ms p=0.810 n=6
Req 3 - references 363ms (± 1.34%) 361ms (± 0.68%) ~ 358ms 365ms p=0.628 n=6
Req 4 - navto 289ms (± 0.52%) 289ms (± 0.51%) ~ 287ms 291ms p=0.934 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 (± 4.19%) 100ms (± 5.85%) ~ 92ms 104ms p=0.742 n=6
CompilerTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 2,951ms (± 0.40%) 2,968ms (± 0.20%) +17ms (+ 0.56%) 2,959ms 2,976ms p=0.016 n=6
Req 2 - geterr 4,604ms (± 1.90%) 4,548ms (± 0.54%) ~ 4,513ms 4,575ms p=0.423 n=6
Req 3 - references 375ms (± 0.54%) 374ms (± 0.44%) ~ 372ms 377ms p=0.677 n=6
Req 4 - navto 298ms (± 0.41%) 298ms (± 0.58%) ~ 295ms 300ms p=0.806 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 (± 8.43%) 77ms (± 3.28%) ~ 75ms 82ms p=0.677 n=6
xstateTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 3,511ms (± 1.21%) 3,508ms (± 1.44%) ~ 3,409ms 3,545ms p=1.000 n=6
Req 2 - geterr 1,849ms (± 0.59%) 1,850ms (± 0.47%) ~ 1,835ms 1,859ms p=0.810 n=6
Req 3 - references 162ms (± 1.08%) 152ms (± 8.03%) ~ 135ms 162ms p=0.102 n=6
Req 4 - navto 394ms (± 0.99%) 394ms (± 0.95%) ~ 388ms 398ms p=0.806 n=6
Req 5 - completionInfo count 2,862 (± 0.00%) 2,862 (± 0.00%) ~ 2,862 2,862 p=1.000 n=6
Req 5 - completionInfo 427ms (± 1.46%) 432ms (± 1.73%) ~ 421ms 441ms p=0.228 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 52642 6
Baseline main 6

Startup

Comparison Report - main..52642
Metric main 52642 Delta Best Worst p-value
tsc-startup - node (v16.17.1, x64)
Execution time 141.80ms (± 0.16%) 141.69ms (± 0.19%) -0.11ms (- 0.08%) 140.60ms 144.26ms p=0.000 n=600
tsserver-startup - node (v16.17.1, x64)
Execution time 220.32ms (± 0.22%) 222.40ms (± 0.38%) +2.08ms (+ 0.94%) 219.46ms 227.79ms p=0.000 n=600
tsserverlibrary-startup - node (v16.17.1, x64)
Execution time 221.66ms (± 0.17%) 223.20ms (± 0.36%) +1.54ms (+ 0.69%) 220.95ms 233.64ms p=0.000 n=600
typescript-startup - node (v16.17.1, x64)
Execution time 203.48ms (± 0.16%) 204.66ms (± 0.26%) +1.18ms (+ 0.58%) 202.91ms 208.15ms 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 52642 6
Baseline main 6

Developer Information:

Download Benchmark

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 like the new error better. Just a couple of small technical suggestions.

src/compiler/checker.ts Outdated Show resolved Hide resolved
src/compiler/checker.ts Outdated Show resolved Hide resolved
@jakebailey
Copy link
Member

@typescript-bot test top200
@typescript-bot user test this
@typescript-bot run dt
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 26, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 26, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 26, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 26, 2023

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

Update: The results are in!

Comment on lines 11884 to 11885
else if ((symbol.flags & SymbolFlags.Alias) && symbol.declarations?.length) {
error(symbol.declarations[0], Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
Copy link
Member

Choose a reason for hiding this comment

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

It doesn't seem like there's anything "importy" about Alias itself; can we get here via non-import means such that this message will be incorrect?

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'm not sure if we can currently get here via non-import means, but it seems like a good check to add, incase more circularity errors are added in the future.

Copy link
Member

Choose a reason for hiding this comment

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

I guess this is more of a comment on the specificity of the error; e,g, would the more generic _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation suffice?

@typescript-bot
Copy link
Collaborator

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

There were infrastructure failures potentially unrelated to your change:

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

Otherwise...

Everything looks good!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Compiler

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Angular - node (v18.15.0, x64)
Memory used 295,141k (± 0.02%) 295,113k (± 0.02%) ~ 295,053k 295,195k p=0.378 n=6
Parse Time 2.63s (± 0.71%) 2.63s (± 0.32%) ~ 2.61s 2.63s p=0.199 n=6
Bind Time 0.84s (± 1.17%) 0.84s (± 1.17%) ~ 0.83s 0.85s p=0.604 n=6
Check Time 8.05s (± 0.24%) 8.04s (± 0.39%) ~ 8.01s 8.10s p=0.568 n=6
Emit Time 7.07s (± 0.23%) 7.09s (± 0.52%) ~ 7.04s 7.13s p=0.232 n=6
Total Time 18.58s (± 0.16%) 18.60s (± 0.17%) ~ 18.54s 18.63s p=0.466 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 193,069k (± 1.47%) 191,669k (± 1.23%) ~ 190,687k 196,482k p=0.378 n=6
Parse Time 1.35s (± 0.98%) 1.37s (± 1.44%) ~ 1.34s 1.39s p=0.120 n=6
Bind Time 0.73s (± 0.00%) 0.73s (± 0.56%) ~ 0.73s 0.74s p=0.405 n=6
Check Time 9.15s (± 0.26%) 9.18s (± 0.37%) ~ 9.15s 9.23s p=0.125 n=6
Emit Time 2.63s (± 0.56%) 2.63s (± 0.40%) ~ 2.61s 2.64s p=0.619 n=6
Total Time 13.86s (± 0.20%) 13.91s (± 0.37%) ~ 13.86s 13.99s p=0.063 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,339k (± 0.01%) 347,332k (± 0.01%) ~ 347,304k 347,357k p=0.748 n=6
Parse Time 2.46s (± 0.57%) 2.45s (± 0.89%) ~ 2.41s 2.47s p=0.560 n=6
Bind Time 0.94s (± 0.67%) 0.94s (± 1.46%) ~ 0.93s 0.97s p=0.654 n=6
Check Time 6.93s (± 0.53%) 6.93s (± 0.30%) ~ 6.90s 6.96s p=0.871 n=6
Emit Time 4.04s (± 0.54%) 4.04s (± 0.37%) ~ 4.03s 4.07s p=0.744 n=6
Total Time 14.38s (± 0.25%) 14.36s (± 0.29%) ~ 14.33s 14.44s p=0.256 n=6
TFS - node (v18.15.0, x64)
Memory used 302,575k (± 0.01%) 302,611k (± 0.02%) ~ 302,547k 302,660k p=0.378 n=6
Parse Time 1.99s (± 0.55%) 1.99s (± 0.41%) ~ 1.97s 1.99s p=0.673 n=6
Bind Time 1.01s (± 0.80%) 1.01s (± 1.15%) ~ 1.00s 1.03s p=0.738 n=6
Check Time 6.25s (± 0.55%) 6.27s (± 0.67%) ~ 6.22s 6.33s p=0.518 n=6
Emit Time 3.58s (± 0.62%) 3.58s (± 0.21%) ~ 3.57s 3.59s p=1.000 n=6
Total Time 12.83s (± 0.41%) 12.84s (± 0.34%) ~ 12.79s 12.89s p=0.687 n=6
material-ui - node (v18.15.0, x64)
Memory used 470,538k (± 0.00%) 470,533k (± 0.01%) ~ 470,493k 470,575k p=0.936 n=6
Parse Time 2.57s (± 0.38%) 2.57s (± 0.43%) ~ 2.55s 2.58s p=0.718 n=6
Bind Time 0.99s (± 0.41%) 0.99s (± 1.56%) ~ 0.97s 1.01s p=0.933 n=6
Check Time 16.63s (± 0.23%) 16.67s (± 0.51%) ~ 16.54s 16.78s p=0.258 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.19s (± 0.21%) 20.22s (± 0.51%) ~ 20.09s 20.36s p=0.378 n=6
xstate - node (v18.15.0, x64)
Memory used 512,637k (± 0.01%) 512,634k (± 0.01%) ~ 512,563k 512,727k p=0.748 n=6
Parse Time 3.27s (± 0.33%) 3.27s (± 0.33%) ~ 3.26s 3.28s p=1.000 n=6
Bind Time 1.55s (± 0.35%) 1.55s (± 0.26%) ~ 1.54s 1.55s p=0.282 n=6
Check Time 2.83s (± 0.66%) 2.84s (± 0.76%) ~ 2.81s 2.87s p=0.416 n=6
Emit Time 0.08s (± 4.99%) 0.08s (± 0.00%) ~ 0.08s 0.08s p=0.405 n=6
Total Time 7.72s (± 0.35%) 7.73s (± 0.31%) ~ 7.70s 7.76s p=0.747 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Angular - node (v18.15.0, x64)
  • Compiler-Unions - node (v18.15.0, x64)
  • Monaco - node (v18.15.0, x64)
  • TFS - node (v18.15.0, x64)
  • material-ui - node (v18.15.0, x64)
  • xstate - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

tsserver

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,370ms (± 0.66%) 2,367ms (± 0.46%) ~ 2,358ms 2,382ms p=1.000 n=6
Req 2 - geterr 5,478ms (± 0.44%) 5,470ms (± 0.27%) ~ 5,456ms 5,491ms p=0.689 n=6
Req 3 - references 327ms (± 0.26%) 327ms (± 0.23%) ~ 326ms 328ms p=0.432 n=6
Req 4 - navto 274ms (± 0.30%) 274ms (± 0.36%) ~ 273ms 275ms p=0.862 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 90ms (± 2.67%) 92ms (± 0.44%) ~ 92ms 93ms p=0.056 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,500ms (± 0.60%) 2,481ms (± 1.04%) ~ 2,455ms 2,518ms p=0.199 n=6
Req 2 - geterr 4,048ms (± 0.19%) 4,052ms (± 0.32%) ~ 4,034ms 4,071ms p=0.573 n=6
Req 3 - references 353ms (± 8.91%) 382ms (± 6.55%) ~ 331ms 396ms p=0.416 n=6
Req 4 - navto 288ms (± 2.06%) 285ms (± 3.69%) ~ 276ms 299ms p=0.369 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 75ms (± 1.08%) 74ms (± 0.85%) -1ms (- 1.77%) 73ms 75ms p=0.023 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,635ms (± 0.56%) 2,633ms (± 0.40%) ~ 2,617ms 2,648ms p=0.471 n=6
Req 2 - geterr 1,747ms (± 1.14%) 1,744ms (± 0.70%) ~ 1,728ms 1,760ms p=0.688 n=6
Req 3 - references 123ms (± 2.29%) 117ms (± 8.24%) ~ 105ms 126ms p=0.683 n=6
Req 4 - navto 364ms (± 0.21%) 365ms (± 0.38%) ~ 363ms 366ms p=0.740 n=6
Req 5 - completionInfo count 2,073 (± 0.00%) 2,073 (± 0.00%) ~ 2,073 2,073 p=1.000 n=6
Req 5 - completionInfo 313ms (± 1.45%) 313ms (± 1.62%) ~ 307ms 321ms p=0.748 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • CompilerTSServer - node (v18.15.0, x64)
  • Compiler-UnionsTSServer - node (v18.15.0, x64)
  • xstateTSServer - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Startup

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
tsc-startup - node (v18.15.0, x64)
Execution time 152.56ms (± 0.18%) 152.48ms (± 0.19%) -0.08ms (- 0.05%) 151.43ms 156.07ms p=0.002 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 258.81ms (± 0.14%) 258.54ms (± 0.20%) -0.27ms (- 0.10%) 257.02ms 263.57ms p=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 239.78ms (± 0.17%) 239.77ms (± 0.14%) ~ 238.30ms 243.59ms p=0.705 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 238.99ms (± 0.13%) 238.88ms (± 0.14%) -0.11ms (- 0.04%) 237.48ms 243.82ms p=0.002 n=600
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • tsc-startup - node (v18.15.0, x64)
  • tsserver-startup - node (v18.15.0, x64)
  • tsserverlibrary-startup - node (v18.15.0, x64)
  • typescript-startup - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

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

@typescript-bot
Copy link
Collaborator

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

Everything looks good!

Comment on lines 11885 to 11888
const symbolImport = symbol.declarations?.find(getAnyImportSyntax);
if (symbolImport) {
error(symbolImport, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
}
Copy link
Member

@jakebailey jakebailey Oct 27, 2023

Choose a reason for hiding this comment

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

I'm not quite sure getAnyImportSyntax is the right helper; that seems to be something specific to visibility rules.

Reading the other place where Circular_definition_of_import_alias_0 is used (resolveAlias), probabably getDeclarationOfAliasSymbol is a good location to put the symbol.

Suggested change
const symbolImport = symbol.declarations?.find(getAnyImportSyntax);
if (symbolImport) {
error(symbolImport, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
}
const node = getDeclarationOfAliasSymbol(symbol);
if (node) {
error(node, Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Are imports always the last declaration? getDeclarationOfAliasSymbol returns the last declaration that is true for isAliasSymbolDeclaration, which from

Alias = 1 << 21, // An alias for another symbol (see comment in isAliasSymbolDeclaration in checker)

seems like it is similar to only checking for SymbolFlags.Alias and may not be specific enough to make sure that the declaration is an import?

Copy link
Member

Choose a reason for hiding this comment

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

No idea; but getDeclarationOfAliasSymbol also only checks & SymbolKind.Symbol and then uses this helper to issue the same error.

@iisaduan
Copy link
Member Author

@typescript-bot test top200
@typescript-bot user test this
@typescript-bot run dt
@typescript-bot perf test this

@iisaduan iisaduan merged commit 29cfca3 into microsoft:main Oct 28, 2023
19 checks passed
@iisaduan iisaduan deleted the fix50928 branch July 9, 2024 17:11
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
Archived in project
Development

Successfully merging this pull request may close these issues.

StackOverflow during completion in TryGhost/Ghost
6 participants