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

Fixed inference between type placeholders with non-string constraints in template literal types #57808

Merged

Conversation

Andarist
Copy link
Contributor

fixes #57807

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Mar 16, 2024
src/compiler/checker.ts Outdated Show resolved Hide resolved
@gabritto
Copy link
Member

@typescript-bot run DT
@typescript-bot user test this
@typescript-bot test top400
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 18, 2024

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

Command Status Results
user test this ✅ Started ✅ Results
test top400 ✅ Started ✅ Results
perf test this ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

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

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Unknown failure"

Otherwise...

Everything looks good!

@Andarist Andarist force-pushed the fix/inference-template-literal-types-generic branch from c4e7828 to d142aae Compare March 18, 2024 18:44
@Andarist Andarist force-pushed the fix/inference-template-literal-types-generic branch from d142aae to 74457df Compare March 18, 2024 18:45
@typescript-bot
Copy link
Collaborator

@gabritto
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
Angular - node (v18.15.0, x64)
Memory used 295,698k (± 0.01%) 295,732k (± 0.01%) +34k (+ 0.01%) 295,717k 295,767k p=0.031 n=6
Parse Time 2.66s (± 0.15%) 2.66s (± 0.19%) ~ 2.66s 2.67s p=0.114 n=6
Bind Time 0.83s (± 0.00%) 0.83s (± 0.00%) ~ 0.83s 0.83s p=1.000 n=6
Check Time 8.20s (± 0.32%) 8.21s (± 0.37%) ~ 8.17s 8.24s p=0.808 n=6
Emit Time 7.13s (± 0.23%) 7.16s (± 0.81%) ~ 7.11s 7.27s p=0.289 n=6
Total Time 18.82s (± 0.21%) 18.85s (± 0.38%) ~ 18.78s 18.98s p=0.687 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 193,776k (± 1.04%) 192,614k (± 0.75%) ~ 191,908k 195,543k p=0.575 n=6
Parse Time 1.36s (± 0.86%) 1.38s (± 1.27%) ~ 1.35s 1.39s p=0.082 n=6
Bind Time 0.72s (± 0.00%) 0.72s (± 0.00%) ~ 0.72s 0.72s p=1.000 n=6
Check Time 9.51s (± 0.59%) 9.51s (± 0.70%) ~ 9.42s 9.58s p=0.936 n=6
Emit Time 2.66s (± 0.15%) 2.66s (± 0.31%) ~ 2.65s 2.67s p=0.285 n=6
Total Time 14.25s (± 0.39%) 14.26s (± 0.52%) ~ 14.17s 14.34s p=0.936 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,354k (± 0.01%) 347,366k (± 0.01%) ~ 347,345k 347,407k p=0.378 n=6
Parse Time 2.48s (± 0.21%) 2.49s (± 0.41%) ~ 2.47s 2.50s p=0.437 n=6
Bind Time 0.93s (± 0.56%) 0.93s (± 0.44%) ~ 0.92s 0.93s p=0.595 n=6
Check Time 7.04s (± 0.53%) 7.02s (± 0.47%) ~ 6.99s 7.07s p=0.518 n=6
Emit Time 4.07s (± 0.48%) 4.07s (± 0.21%) ~ 4.06s 4.08s p=0.358 n=6
Total Time 14.51s (± 0.29%) 14.51s (± 0.24%) ~ 14.47s 14.57s p=1.000 n=6
TFS - node (v18.15.0, x64)
Memory used 302,738k (± 0.01%) 302,731k (± 0.01%) ~ 302,694k 302,775k p=0.810 n=6
Parse Time 2.02s (± 0.87%) 2.00s (± 1.11%) -0.03s (- 1.32%) 1.96s 2.02s p=0.042 n=6
Bind Time 1.00s (± 0.63%) 1.00s (± 1.03%) ~ 0.99s 1.02s p=0.654 n=6
Check Time 6.31s (± 0.34%) 6.32s (± 0.39%) ~ 6.29s 6.35s p=0.746 n=6
Emit Time 3.61s (± 0.34%) 3.61s (± 0.21%) ~ 3.60s 3.62s p=0.485 n=6
Total Time 12.95s (± 0.27%) 12.93s (± 0.44%) ~ 12.86s 12.99s p=0.747 n=6
material-ui - node (v18.15.0, x64)
Memory used 511,356k (± 0.00%) 511,365k (± 0.00%) ~ 511,348k 511,381k p=0.199 n=6
Parse Time 2.65s (± 0.56%) 2.66s (± 0.70%) ~ 2.63s 2.68s p=0.463 n=6
Bind Time 0.98s (± 0.56%) 0.98s (± 0.85%) ~ 0.97s 0.99s p=0.855 n=6
Check Time 17.31s (± 0.18%) 17.36s (± 0.18%) +0.05s (+ 0.30%) 17.31s 17.40s p=0.035 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.94s (± 0.15%) 21.00s (± 0.22%) ~ 20.91s 21.03s p=0.053 n=6
mui-docs - node (v18.15.0, x64)
Memory used 1,798,670k (± 0.00%) 1,798,670k (± 0.00%) ~ 1,798,652k 1,798,696k p=0.936 n=6
Parse Time 6.63s (± 0.48%) 6.63s (± 0.48%) ~ 6.59s 6.68s p=1.000 n=6
Bind Time 2.40s (± 0.67%) 2.39s (± 0.34%) ~ 2.38s 2.40s p=1.000 n=6
Check Time 58.99s (± 0.23%) 59.12s (± 0.53%) ~ 58.73s 59.66s p=0.521 n=6
Emit Time 0.17s (± 3.10%) 0.16s (± 2.52%) ~ 0.16s 0.17s p=0.112 n=6
Total Time 68.18s (± 0.22%) 68.30s (± 0.45%) ~ 67.89s 68.80s p=0.471 n=6
self-build-src - node (v18.15.0, x64)
Memory used 2,397,337k (± 0.01%) 2,397,349k (± 0.02%) ~ 2,396,648k 2,398,030k p=0.810 n=6
Parse Time 5.04s (± 1.09%) 5.02s (± 0.88%) ~ 4.98s 5.09s p=0.936 n=6
Bind Time 1.91s (± 1.07%) 1.91s (± 1.12%) ~ 1.89s 1.94s p=0.737 n=6
Check Time 33.56s (± 0.48%) 33.59s (± 0.40%) ~ 33.40s 33.78s p=0.575 n=6
Emit Time 2.74s (± 1.21%) 2.73s (± 1.80%) ~ 2.65s 2.80s p=1.000 n=6
Total Time 43.26s (± 0.39%) 43.28s (± 0.45%) ~ 42.96s 43.50s p=0.936 n=6
self-compiler - node (v18.15.0, x64)
Memory used 415,513k (± 0.01%) 415,520k (± 0.01%) ~ 415,462k 415,587k p=0.936 n=6
Parse Time 2.80s (± 1.97%) 2.81s (± 2.71%) ~ 2.66s 2.87s p=0.871 n=6
Bind Time 1.10s (± 5.15%) 1.09s (± 5.57%) ~ 1.06s 1.21s p=0.090 n=6
Check Time 15.33s (± 0.42%) 15.34s (± 0.31%) ~ 15.29s 15.42s p=0.629 n=6
Emit Time 1.15s (± 0.65%) 1.15s (± 0.55%) ~ 1.14s 1.16s p=0.718 n=6
Total Time 20.38s (± 0.38%) 20.39s (± 0.35%) ~ 20.32s 20.51s p=0.873 n=6
vscode - node (v18.15.0, x64)
Memory used 2,882,784k (± 0.00%) 2,882,730k (± 0.00%) ~ 2,882,544k 2,882,853k p=0.230 n=6
Parse Time 10.83s (± 0.55%) 10.80s (± 0.22%) ~ 10.78s 10.84s p=0.418 n=6
Bind Time 3.46s (± 0.64%) 3.45s (± 0.34%) ~ 3.43s 3.46s p=0.622 n=6
Check Time 61.55s (± 0.48%) 61.57s (± 0.40%) ~ 61.21s 61.94s p=0.810 n=6
Emit Time 17.02s (± 8.20%) 17.03s (± 8.42%) ~ 16.31s 19.95s p=0.936 n=6
Total Time 92.86s (± 1.75%) 92.85s (± 1.77%) ~ 91.78s 96.16s p=1.000 n=6
webpack - node (v18.15.0, x64)
Memory used 407,999k (± 0.01%) 407,931k (± 0.01%) -68k (- 0.02%) 407,885k 407,968k p=0.020 n=6
Parse Time 3.22s (± 0.69%) 3.23s (± 0.38%) ~ 3.21s 3.24s p=0.289 n=6
Bind Time 1.38s (± 0.87%) 1.38s (± 0.85%) ~ 1.37s 1.40s p=0.868 n=6
Check Time 14.28s (± 0.37%) 14.28s (± 0.28%) ~ 14.22s 14.32s p=0.809 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 18.88s (± 0.32%) 18.89s (± 0.23%) ~ 18.82s 18.93s p=0.936 n=6
xstate - node (v18.15.0, x64)
Memory used 513,248k (± 0.01%) 513,265k (± 0.01%) ~ 513,217k 513,336k p=0.575 n=6
Parse Time 3.28s (± 0.23%) 3.28s (± 0.16%) ~ 3.27s 3.28s p=0.241 n=6
Bind Time 1.54s (± 0.41%) 1.54s (± 0.27%) ~ 1.53s 1.54s p=0.673 n=6
Check Time 2.84s (± 0.41%) 2.84s (± 0.36%) ~ 2.83s 2.86s p=0.244 n=6
Emit Time 0.07s (± 0.00%) 0.07s (± 7.03%) ~ 0.07s 0.08s p=0.174 n=6
Total Time 7.74s (± 0.16%) 7.75s (± 0.14%) ~ 7.73s 7.76s p=0.250 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)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - 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,342ms (± 0.72%) 2,340ms (± 0.65%) ~ 2,319ms 2,363ms p=1.000 n=6
Req 2 - geterr 5,794ms (± 0.45%) 5,787ms (± 0.45%) ~ 5,759ms 5,835ms p=0.471 n=6
Req 3 - references 326ms (± 1.00%) 324ms (± 1.19%) ~ 319ms 331ms p=0.548 n=6
Req 4 - navto 271ms (± 1.13%) 274ms (± 0.50%) ~ 272ms 276ms p=0.063 n=6
Req 5 - completionInfo count 1,357 (± 0.00%) 1,357 (± 0.00%) ~ 1,357 1,357 p=1.000 n=6
Req 5 - completionInfo 95ms (± 1.04%) 93ms (± 4.76%) ~ 84ms 95ms p=0.391 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,484ms (± 1.06%) 2,505ms (± 0.50%) ~ 2,488ms 2,516ms p=0.230 n=6
Req 2 - geterr 4,239ms (± 1.59%) 4,273ms (± 0.20%) ~ 4,257ms 4,282ms p=0.076 n=6
Req 3 - references 331ms (± 1.21%) 332ms (± 0.46%) ~ 329ms 333ms p=0.935 n=6
Req 4 - navto 284ms (± 0.35%) 284ms (± 0.56%) ~ 283ms 287ms p=0.931 n=6
Req 5 - completionInfo count 1,519 (± 0.00%) 1,519 (± 0.00%) ~ 1,519 1,519 p=1.000 n=6
Req 5 - completionInfo 78ms (± 3.12%) 78ms (± 0.81%) ~ 77ms 79ms p=0.720 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,614ms (± 0.49%) 2,618ms (± 0.49%) ~ 2,601ms 2,637ms p=0.748 n=6
Req 2 - geterr 1,705ms (± 2.65%) 1,709ms (± 1.92%) ~ 1,663ms 1,743ms p=0.873 n=6
Req 3 - references 118ms (± 9.92%) 125ms (± 6.65%) ~ 108ms 130ms p=0.452 n=6
Req 4 - navto 369ms (± 1.15%) 370ms (± 0.59%) ~ 366ms 372ms p=1.000 n=6
Req 5 - completionInfo count 2,079 (± 0.00%) 2,079 (± 0.00%) ~ 2,079 2,079 p=1.000 n=6
Req 5 - completionInfo 303ms (± 0.57%) 305ms (± 1.36%) ~ 299ms 310ms p=0.421 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 154.13ms (± 0.19%) 154.00ms (± 0.21%) -0.13ms (- 0.09%) 152.92ms 157.93ms p=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 230.02ms (± 0.17%) 229.89ms (± 0.15%) -0.13ms (- 0.05%) 228.51ms 235.67ms p=0.001 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 222.22ms (± 0.16%) 222.06ms (± 0.15%) -0.16ms (- 0.07%) 220.71ms 226.58ms p=0.000 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 222.66ms (± 0.15%) 222.79ms (± 0.17%) +0.13ms (+ 0.06%) 221.21ms 228.49ms p=0.001 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

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

Everything looks good!

@gabritto
Copy link
Member

@typescript-bot run dt

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 18, 2024

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

Command Status Results
run dt ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

Hey @gabritto, the results of running the DT tests are ready.
Everything looks the same!
You can check the log here.

@gabritto gabritto merged commit a46664a into microsoft:main Mar 18, 2024
26 checks passed
@Andarist Andarist deleted the fix/inference-template-literal-types-generic branch March 18, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken inference between type placeholders with non-string constraints in template literal types
3 participants