TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Fix #61098

Open HansBrende opened this issue 9 months ago • 11 comments
trafficstars

Fixes #61098

HansBrende avatar Feb 04 '25 20:02 HansBrende

@microsoft-github-policy-service agree company="iMuto Software Solutions LLC"

HansBrende avatar Feb 04 '25 20:02 HansBrende

@typescript-bot test it

RyanCavanaugh avatar Feb 07 '25 16:02 RyanCavanaugh

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

Command Status Results
test top400 ✅ Started ✅ Results
user test this ✅ Started ✅ Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results

typescript-bot avatar Feb 07 '25 16:02 typescript-bot

@RyanCavanaugh Here are the results of running the user tests with tsc comparing main and refs/pull/61113/merge:

Everything looks good!

typescript-bot avatar Feb 07 '25 16:02 typescript-bot

Hey @RyanCavanaugh, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

typescript-bot avatar Feb 07 '25 17:02 typescript-bot

@RyanCavanaugh 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 (v18.15.0, x64)
Errors 34 34 ~ ~ ~ p=1.000 n=6
Symbols 62,390 62,390 ~ ~ ~ p=1.000 n=6
Types 50,395 50,395 ~ ~ ~ p=1.000 n=6
Memory used 194,385k (± 1.00%) 194,423k (± 1.02%) ~ 193,111k 196,987k p=0.575 n=6
Parse Time 1.31s (± 0.80%) 1.31s (± 0.75%) ~ 1.30s 1.33s p=0.343 n=6
Bind Time 0.73s 0.73s ~ ~ ~ p=1.000 n=6
Check Time 9.75s (± 0.41%) 9.79s (± 0.18%) +0.04s (+ 0.46%) 9.78s 9.83s p=0.020 n=6
Emit Time 2.73s (± 0.38%) 2.73s (± 0.68%) ~ 2.71s 2.76s p=0.370 n=6
Total Time 14.51s (± 0.39%) 14.57s (± 0.25%) ~ 14.54s 14.63s p=0.090 n=6
angular-1 - node (v18.15.0, x64)
Errors 37 37 ~ ~ ~ p=1.000 n=6
Symbols 948,488 948,488 ~ ~ ~ p=1.000 n=6
Types 411,006 411,006 ~ ~ ~ p=1.000 n=6
Memory used 1,225,460k (± 0.00%) 1,225,454k (± 0.00%) ~ 1,225,358k 1,225,535k p=0.936 n=6
Parse Time 6.63s (± 1.12%) 6.68s (± 0.45%) ~ 6.64s 6.72s p=0.375 n=6
Bind Time 1.89s (± 0.67%) 1.88s (± 0.56%) ~ 1.87s 1.90s p=0.456 n=6
Check Time 31.92s (± 0.25%) 31.99s (± 0.22%) ~ 31.89s 32.07s p=0.170 n=6
Emit Time 15.23s (± 0.54%) 15.21s (± 0.50%) ~ 15.10s 15.32s p=0.521 n=6
Total Time 55.68s (± 0.14%) 55.76s (± 0.24%) ~ 55.52s 55.92s p=0.229 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,372,446 2,372,446 ~ ~ ~ p=1.000 n=6
Types 846,261 846,261 ~ ~ ~ p=1.000 n=6
Memory used 2,139,057k (± 0.00%) 2,139,002k (± 0.00%) ~ 2,138,887k 2,139,118k p=0.470 n=6
Parse Time 7.27s (± 0.18%) 7.27s (± 0.47%) ~ 7.23s 7.33s p=0.870 n=6
Bind Time 2.47s (± 0.91%) 2.45s (± 0.36%) -0.02s (- 0.94%) 2.44s 2.46s p=0.040 n=6
Check Time 72.24s (± 1.44%) 73.08s (± 0.52%) ~ 72.63s 73.54s p=0.092 n=6
Emit Time 0.15s (± 3.52%) 0.15s (± 3.77%) ~ 0.14s 0.15s p=0.640 n=6
Total Time 82.13s (± 1.23%) 82.95s (± 0.50%) ~ 82.47s 83.48s p=0.093 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,229,397 1,229,400 +3 (+ 0.00%) ~ ~ p=0.001 n=6
Types 267,085 267,085 ~ ~ ~ p=1.000 n=6
Memory used 2,362,446k (± 0.02%) 2,362,085k (± 0.02%) ~ 2,361,427k 2,362,562k p=0.230 n=6
Parse Time 5.23s (± 0.88%) 5.26s (± 0.76%) ~ 5.21s 5.31s p=0.378 n=6
Bind Time 1.79s (± 1.10%) 1.79s (± 0.61%) ~ 1.78s 1.81s p=0.619 n=6
Check Time 35.28s (± 0.24%) 35.28s (± 0.33%) ~ 35.17s 35.50s p=0.335 n=6
Emit Time 3.03s (± 0.74%) 3.00s (± 0.53%) ~ 2.98s 3.02s p=0.065 n=6
Total Time 45.33s (± 0.19%) 45.32s (± 0.22%) ~ 45.24s 45.50s p=0.936 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,229,397 1,229,400 +3 (+ 0.00%) ~ ~ p=0.001 n=6
Types 267,085 267,085 ~ ~ ~ p=1.000 n=6
Memory used 2,917,923k (±12.85%) 2,553,190k (±11.64%) ~ 2,430,838k 3,160,316k p=0.066 n=6
Parse Time 6.98s (± 1.89%) 6.88s (± 2.01%) ~ 6.75s 7.14s p=0.298 n=6
Bind Time 2.16s (± 0.99%) 2.18s (± 1.49%) ~ 2.13s 2.22s p=0.126 n=6
Check Time 42.87s (± 0.57%) 42.87s (± 0.55%) ~ 42.45s 43.14s p=0.810 n=6
Emit Time 3.49s (± 1.25%) 3.56s (± 2.66%) ~ 3.44s 3.68s p=0.199 n=6
Total Time 55.49s (± 0.70%) 55.48s (± 0.58%) ~ 55.05s 55.85s p=0.936 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 263,074 263,077 +3 (+ 0.00%) ~ ~ p=0.001 n=6
Types 106,881 106,881 ~ ~ ~ p=1.000 n=6
Memory used 441,345k (± 0.01%) 441,330k (± 0.02%) ~ 441,254k 441,435k p=0.689 n=6
Parse Time 3.55s (± 0.92%) 3.52s (± 0.85%) ~ 3.48s 3.55s p=0.195 n=6
Bind Time 1.31s (± 0.79%) 1.31s (± 1.08%) ~ 1.29s 1.33s p=0.738 n=6
Check Time 19.02s (± 0.41%) 18.98s (± 0.52%) ~ 18.83s 19.11s p=0.521 n=6
Emit Time 1.52s (± 0.99%) 1.52s (± 1.53%) ~ 1.49s 1.55s p=1.000 n=6
Total Time 25.39s (± 0.33%) 25.33s (± 0.37%) ~ 25.21s 25.48s p=0.148 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 70 70 ~ ~ ~ p=1.000 n=6
Symbols 226,113 226,113 ~ ~ ~ p=1.000 n=6
Types 94,488 94,488 ~ ~ ~ p=1.000 n=6
Memory used 371,783k (± 0.01%) 371,836k (± 0.04%) ~ 371,714k 372,036k p=0.521 n=6
Parse Time 2.92s (± 0.56%) 2.88s (± 0.81%) -0.03s (- 1.14%) 2.85s 2.91s p=0.043 n=6
Bind Time 1.60s (± 1.02%) 1.59s (± 1.10%) ~ 1.56s 1.61s p=0.162 n=6
Check Time 16.43s (± 0.19%) 16.45s (± 0.44%) ~ 16.35s 16.56s p=0.468 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 20.95s (± 0.24%) 20.93s (± 0.45%) ~ 20.77s 21.02s p=0.936 n=6
vscode - node (v18.15.0, x64)
Errors 3 3 ~ ~ ~ p=1.000 n=6
Symbols 3,285,568 3,285,568 ~ ~ ~ p=1.000 n=6
Types 1,129,607 1,129,607 ~ ~ ~ p=1.000 n=6
Memory used 3,357,302k (± 0.01%) 3,357,442k (± 0.01%) ~ 3,357,057k 3,357,874k p=0.471 n=6
Parse Time 14.57s (± 0.43%) 14.60s (± 0.34%) ~ 14.52s 14.67s p=0.375 n=6
Bind Time 4.65s (± 1.78%) 4.67s (± 2.72%) ~ 4.56s 4.92s p=0.687 n=6
Check Time 91.39s (± 1.88%) 89.09s (± 0.48%) ~ 88.38s 89.69s p=0.066 n=6
Emit Time 28.62s (± 3.18%) 28.50s (± 3.59%) ~ 27.36s 29.52s p=0.575 n=6
Total Time 139.23s (± 0.96%) 136.86s (± 0.95%) -2.37s (- 1.70%) 135.07s 138.28s p=0.020 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 293,381 293,381 ~ ~ ~ p=1.000 n=6
Types 119,582 119,582 ~ ~ ~ p=1.000 n=6
Memory used 447,160k (± 0.02%) 447,191k (± 0.02%) ~ 447,029k 447,303k p=0.521 n=6
Parse Time 4.10s (± 1.18%) 4.08s (± 1.25%) ~ 4.01s 4.14s p=0.467 n=6
Bind Time 1.79s (± 0.91%) 1.78s (± 0.66%) ~ 1.76s 1.79s p=0.462 n=6
Check Time 18.83s (± 0.45%) 18.85s (± 0.50%) ~ 18.72s 18.95s p=0.810 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.72s (± 0.46%) 24.71s (± 0.50%) ~ 24.51s 24.80s p=0.936 n=6
xstate-main - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 555,375 555,375 ~ ~ ~ p=1.000 n=6
Types 186,146 186,146 ~ ~ ~ p=1.000 n=6
Memory used 494,483k (± 0.03%) 494,440k (± 0.03%) ~ 494,254k 494,667k p=0.378 n=6
Parse Time 3.40s (± 0.64%) 3.42s (± 0.86%) ~ 3.37s 3.45s p=0.259 n=6
Bind Time 1.19s (± 1.26%) 1.19s (± 0.69%) ~ 1.17s 1.19s p=0.241 n=6
Check Time 19.68s (± 1.61%) 19.83s (± 2.17%) ~ 19.53s 20.57s p=0.520 n=6
Emit Time 0.00s 0.00s (±244.70%) ~ 0.00s 0.01s p=0.405 n=6
Total Time 24.28s (± 1.34%) 24.44s (± 1.83%) ~ 24.13s 25.19s p=0.630 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6
Developer Information:

Download Benchmarks

typescript-bot avatar Feb 07 '25 17:02 typescript-bot

@RyanCavanaugh Here are the results of running the top 400 repos with tsc comparing main and refs/pull/61113/merge:

Everything looks good!

typescript-bot avatar Feb 07 '25 18:02 typescript-bot

Perhaps @jakebailey might be interested in reviewing this PR since it fixes a regression that was introduced in https://github.com/microsoft/TypeScript/pull/52836?

HansBrende avatar Mar 19 '25 16:03 HansBrende

Some related code was all redone in #56434. I'll be honest when I say I don't know if my mental model of how this all is supposed to work is good enough to determine that this pure code addition is correct, or if there is something somewhere else that is what's supposed to be fixed.

jakebailey avatar Mar 19 '25 16:03 jakebailey

@jakebailey from looking at the TS codebase, I believe that the only reason this was working before https://github.com/microsoft/TypeScript/pull/52836 was that primitive types that reached the isTypeIdenticalTo block during isTypeAssignableTo were quite simply cached so they compared as equal with ===. Allowing tagged strings within template or mapped strings broke this memoization, so they no longer compared as equal with ===, requiring explicit checks for the cases of template and mapped strings instead of the simple === check.

(FYI I used every-ts to bisect to https://github.com/microsoft/TypeScript/pull/52836).

Question: if you don't feel confident reviewing this, do you know anyone who would? I was told that if I submitted this PR, someone would look at it, but I've heard radio silence. (Just hoping that the PR doesn't end up in a landfill somewhere, haha 🤞 ).

HansBrende avatar Mar 19 '25 16:03 HansBrende

That analysis is helpful, thanks. I'd hazard a guess that this is correct, then.

jakebailey avatar Mar 19 '25 16:03 jakebailey

@jakebailey quick follow-up question: I noticed in typescript-go, this bug would still be present: https://github.com/microsoft/typescript-go/blob/main/internal/checker/relater.go#L3296

Am I expected to open an equivalent PR/issue over there if I want it to be fixed in both places, or will all the bugfixes automatically get ported over there as well without my intervention?

HansBrende avatar May 02 '25 18:05 HansBrende

We have months of PRs to port over, so don't worry about it quite yet until we point the TypeScript-go's target commit to one past this PR (and therefore tests will be present and be fixable).

jakebailey avatar May 02 '25 20:05 jakebailey