Skip to content

Fix #61098 - #61113

Merged
Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
HansBrende:fix61098
Apr 24, 2025
Merged

Fix #61098#61113
Jake Bailey (jakebailey) merged 2 commits into
microsoft:mainfrom
HansBrende:fix61098

Conversation

@HansBrende

Copy link
Copy Markdown
Contributor

Fixes#61098

@typescript-botTypeScript Bot (typescript-bot) added the For Backlog Bug PRs that fix a backlog bug label Feb 4, 2025
@HansBrende

Copy link
Copy Markdown
ContributorAuthor

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

@RyanCavanaugh

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test it

@typescript-bot

TypeScript Bot (typescript-bot) commented Feb 7, 2025

Copy link
Copy Markdown
Contributor

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

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

@typescript-bot

Copy link
Copy Markdown
Contributor

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

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Ryan Cavanaugh (@RyanCavanaugh), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Ryan Cavanaugh (@RyanCavanaugh)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3434~~~p=1.000 n=6
Symbols62,39062,390~~~p=1.000 n=6
Types50,39550,395~~~p=1.000 n=6
Memory used194,385k (± 1.00%)194,423k (± 1.02%)~193,111k196,987kp=0.575 n=6
Parse Time1.31s (± 0.80%)1.31s (± 0.75%)~1.30s1.33sp=0.343 n=6
Bind Time0.73s0.73s~~~p=1.000 n=6
Check Time9.75s (± 0.41%)9.79s (± 0.18%)+0.04s (+ 0.46%)9.78s9.83sp=0.020 n=6
Emit Time2.73s (± 0.38%)2.73s (± 0.68%)~2.71s2.76sp=0.370 n=6
Total Time14.51s (± 0.39%)14.57s (± 0.25%)~14.54s14.63sp=0.090 n=6
angular-1 - node (v18.15.0, x64)
Errors3737~~~p=1.000 n=6
Symbols948,488948,488~~~p=1.000 n=6
Types411,006411,006~~~p=1.000 n=6
Memory used1,225,460k (± 0.00%)1,225,454k (± 0.00%)~1,225,358k1,225,535kp=0.936 n=6
Parse Time6.63s (± 1.12%)6.68s (± 0.45%)~6.64s6.72sp=0.375 n=6
Bind Time1.89s (± 0.67%)1.88s (± 0.56%)~1.87s1.90sp=0.456 n=6
Check Time31.92s (± 0.25%)31.99s (± 0.22%)~31.89s32.07sp=0.170 n=6
Emit Time15.23s (± 0.54%)15.21s (± 0.50%)~15.10s15.32sp=0.521 n=6
Total Time55.68s (± 0.14%)55.76s (± 0.24%)~55.52s55.92sp=0.229 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,372,4462,372,446~~~p=1.000 n=6
Types846,261846,261~~~p=1.000 n=6
Memory used2,139,057k (± 0.00%)2,139,002k (± 0.00%)~2,138,887k2,139,118kp=0.470 n=6
Parse Time7.27s (± 0.18%)7.27s (± 0.47%)~7.23s7.33sp=0.870 n=6
Bind Time2.47s (± 0.91%)2.45s (± 0.36%)-0.02s (- 0.94%)2.44s2.46sp=0.040 n=6
Check Time72.24s (± 1.44%)73.08s (± 0.52%)~72.63s73.54sp=0.092 n=6
Emit Time0.15s (± 3.52%)0.15s (± 3.77%)~0.14s0.15sp=0.640 n=6
Total Time82.13s (± 1.23%)82.95s (± 0.50%)~82.47s83.48sp=0.093 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,229,3971,229,400+3 (+ 0.00%)~~p=0.001 n=6
Types267,085267,085~~~p=1.000 n=6
Memory used2,362,446k (± 0.02%)2,362,085k (± 0.02%)~2,361,427k2,362,562kp=0.230 n=6
Parse Time5.23s (± 0.88%)5.26s (± 0.76%)~5.21s5.31sp=0.378 n=6
Bind Time1.79s (± 1.10%)1.79s (± 0.61%)~1.78s1.81sp=0.619 n=6
Check Time35.28s (± 0.24%)35.28s (± 0.33%)~35.17s35.50sp=0.335 n=6
Emit Time3.03s (± 0.74%)3.00s (± 0.53%)~2.98s3.02sp=0.065 n=6
Total Time45.33s (± 0.19%)45.32s (± 0.22%)~45.24s45.50sp=0.936 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,229,3971,229,400+3 (+ 0.00%)~~p=0.001 n=6
Types267,085267,085~~~p=1.000 n=6
Memory used2,917,923k (±12.85%)2,553,190k (±11.64%)~2,430,838k3,160,316kp=0.066 n=6
Parse Time6.98s (± 1.89%)6.88s (± 2.01%)~6.75s7.14sp=0.298 n=6
Bind Time2.16s (± 0.99%)2.18s (± 1.49%)~2.13s2.22sp=0.126 n=6
Check Time42.87s (± 0.57%)42.87s (± 0.55%)~42.45s43.14sp=0.810 n=6
Emit Time3.49s (± 1.25%)3.56s (± 2.66%)~3.44s3.68sp=0.199 n=6
Total Time55.49s (± 0.70%)55.48s (± 0.58%)~55.05s55.85sp=0.936 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols263,074263,077+3 (+ 0.00%)~~p=0.001 n=6
Types106,881106,881~~~p=1.000 n=6
Memory used441,345k (± 0.01%)441,330k (± 0.02%)~441,254k441,435kp=0.689 n=6
Parse Time3.55s (± 0.92%)3.52s (± 0.85%)~3.48s3.55sp=0.195 n=6
Bind Time1.31s (± 0.79%)1.31s (± 1.08%)~1.29s1.33sp=0.738 n=6
Check Time19.02s (± 0.41%)18.98s (± 0.52%)~18.83s19.11sp=0.521 n=6
Emit Time1.52s (± 0.99%)1.52s (± 1.53%)~1.49s1.55sp=1.000 n=6
Total Time25.39s (± 0.33%)25.33s (± 0.37%)~25.21s25.48sp=0.148 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors7070~~~p=1.000 n=6
Symbols226,113226,113~~~p=1.000 n=6
Types94,48894,488~~~p=1.000 n=6
Memory used371,783k (± 0.01%)371,836k (± 0.04%)~371,714k372,036kp=0.521 n=6
Parse Time2.92s (± 0.56%)2.88s (± 0.81%)-0.03s (- 1.14%)2.85s2.91sp=0.043 n=6
Bind Time1.60s (± 1.02%)1.59s (± 1.10%)~1.56s1.61sp=0.162 n=6
Check Time16.43s (± 0.19%)16.45s (± 0.44%)~16.35s16.56sp=0.468 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time20.95s (± 0.24%)20.93s (± 0.45%)~20.77s21.02sp=0.936 n=6
vscode - node (v18.15.0, x64)
Errors33~~~p=1.000 n=6
Symbols3,285,5683,285,568~~~p=1.000 n=6
Types1,129,6071,129,607~~~p=1.000 n=6
Memory used3,357,302k (± 0.01%)3,357,442k (± 0.01%)~3,357,057k3,357,874kp=0.471 n=6
Parse Time14.57s (± 0.43%)14.60s (± 0.34%)~14.52s14.67sp=0.375 n=6
Bind Time4.65s (± 1.78%)4.67s (± 2.72%)~4.56s4.92sp=0.687 n=6
Check Time91.39s (± 1.88%)89.09s (± 0.48%)~88.38s89.69sp=0.066 n=6
Emit Time28.62s (± 3.18%)28.50s (± 3.59%)~27.36s29.52sp=0.575 n=6
Total Time139.23s (± 0.96%)136.86s (± 0.95%)-2.37s (- 1.70%)135.07s138.28sp=0.020 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols293,381293,381~~~p=1.000 n=6
Types119,582119,582~~~p=1.000 n=6
Memory used447,160k (± 0.02%)447,191k (± 0.02%)~447,029k447,303kp=0.521 n=6
Parse Time4.10s (± 1.18%)4.08s (± 1.25%)~4.01s4.14sp=0.467 n=6
Bind Time1.79s (± 0.91%)1.78s (± 0.66%)~1.76s1.79sp=0.462 n=6
Check Time18.83s (± 0.45%)18.85s (± 0.50%)~18.72s18.95sp=0.810 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time24.72s (± 0.46%)24.71s (± 0.50%)~24.51s24.80sp=0.936 n=6
xstate-main - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols555,375555,375~~~p=1.000 n=6
Types186,146186,146~~~p=1.000 n=6
Memory used494,483k (± 0.03%)494,440k (± 0.03%)~494,254k494,667kp=0.378 n=6
Parse Time3.40s (± 0.64%)3.42s (± 0.86%)~3.37s3.45sp=0.259 n=6
Bind Time1.19s (± 1.26%)1.19s (± 0.69%)~1.17s1.19sp=0.241 n=6
Check Time19.68s (± 1.61%)19.83s (± 2.17%)~19.53s20.57sp=0.520 n=6
Emit Time0.00s0.00s (±244.70%)~0.00s0.01sp=0.405 n=6
Total Time24.28s (± 1.34%)24.44s (± 1.83%)~24.13s25.19sp=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)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

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

Everything looks good!

@HansBrende

Copy link
Copy Markdown
ContributorAuthor

Perhaps Jake Bailey (@jakebailey) might be interested in reviewing this PR since it fixes a regression that was introduced in #52836?

@jakebailey

Copy link
Copy Markdown
Member

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.

@HansBrende

Hans Brende (HansBrende) commented Mar 19, 2025

Copy link
Copy Markdown
ContributorAuthor

Jake Bailey (@jakebailey) from looking at the TS codebase, I believe that the only reason this was working before #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 #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 🤞 ).

@jakebailey

Copy link
Copy Markdown
Member

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

Comment threadsrc/compiler/checker.ts
@github-project-automationgithub-project-automationBot moved this from Not started to Needs merge in PR BacklogApr 24, 2025

@jakebaileyJake Bailey (jakebailey) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM; just looking at the way indexed, conditional, substitution types work in the lines above, it's clear to me that the new code is correct as it structurally checks the type in the same way.

@jakebailey
Jake Bailey (jakebailey) merged commit 75202af into microsoft:mainApr 24, 2025
@github-project-automationgithub-project-automationBot moved this from Needs merge to Done in PR BacklogApr 24, 2025
@HansBrende

Copy link
Copy Markdown
ContributorAuthor

Jake Bailey (@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?

@jakebailey

Copy link
Copy Markdown
Member

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

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog BugPRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Type containing templated, branded string is not assignable to itself

5 participants

@HansBrende@RyanCavanaugh@typescript-bot@jakebailey@andrewbranch