Skip to content

Fix circularity errors in intra-binding-pattern references #59183

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
Jul 15, 2024

Conversation

ahejlsberg
Copy link
Member

@ahejlsberg ahejlsberg commented Jul 8, 2024

This PR reverts #56753 and implements a new fix for #49989.

Consider the example:

const [a, b = a + 1] = [42];

The array literal [42] is contextually typed by the implied type of the binding pattern. To compute the implied type, we substitute any for for the first element (because it has no initializer) and the type of a + 1 for the second element. However, to compute the type of a + 1 we need the type of a, which in turn means we need the type of [42][0], which means we need to know the type of the array literal [42], which is contextually typed by the implied type of the binding pattern... and we have a circularity.

In #56753, logic was introduced that silently squelches circularity errors, but that isn't feasible because it is highly dependent on resolution order. In this PR we instead introduce logic that detects intra-binding-pattern references (such as the reference to a in a + 1) and types them as any when computing implied binding pattern types.

Though strictly not necessary for the fix, the PR also revises the manner in which we "pad" types of initializer expressions for object destructuring patterns. This used to happen in checkObjectLiteral but now happens in checkDeclarationInitializer, aligning with the way we pad types of initializer expressions for array destructuring patterns. This change is responsible for the "Initializer provides no value for this binding element and the binding element has no default value" errors changing to messages like "Property 'a' does not exist on type '{}'" in the baselines.

Fixes #49989.
Fixes #59177.

@typescript-bot typescript-bot added Author: Team For Backlog Bug PRs that fix a backlog bug For Milestone Bug PRs that fix a bug with a specific milestone labels Jul 8, 2024
@ahejlsberg
Copy link
Member Author

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 8, 2024

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
Copy link
Collaborator

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

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@ahejlsberg
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 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 192,145k (± 0.02%) 193,988k (± 1.03%) ~ 192,130k 195,910k p=0.066 n=6
Parse Time 1.31s (± 0.75%) 1.31s (± 1.12%) ~ 1.30s 1.34s p=0.929 n=6
Bind Time 0.71s 0.71s ~ ~ ~ p=1.000 n=6
Check Time 9.43s (± 0.42%) 9.42s (± 0.50%) ~ 9.37s 9.51s p=0.374 n=6
Emit Time 2.75s (± 0.70%) 2.75s (± 0.95%) ~ 2.71s 2.78s p=1.000 n=6
Total Time 14.21s (± 0.28%) 14.19s (± 0.31%) ~ 14.12s 14.24s p=0.571 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,120 +6 (+ 0.00%) ~ ~ p=0.001 n=6
Types 407,050 407,047 -3 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 1,218,385k (± 0.00%) 1,218,365k (± 0.00%) ~ 1,218,309k 1,218,409k p=0.575 n=6
Parse Time 6.66s (± 0.48%) 6.66s (± 0.22%) ~ 6.64s 6.68s p=0.628 n=6
Bind Time 1.87s (± 0.55%) 1.87s (± 0.28%) ~ 1.87s 1.88s p=0.928 n=6
Check Time 30.57s (± 0.17%) 30.61s (± 0.43%) ~ 30.50s 30.86s p=0.936 n=6
Emit Time 13.58s (± 0.48%) 13.60s (± 0.31%) ~ 13.53s 13.64s p=0.376 n=6
Total Time 52.67s (± 0.08%) 52.74s (± 0.28%) ~ 52.60s 53.03s p=0.419 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,130,343 2,130,347 +4 (+ 0.00%) ~ ~ p=0.001 n=6
Types 927,684 927,683 -1 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,107,213k (± 0.00%) 2,107,302k (± 0.00%) +89k (+ 0.00%) 2,107,219k 2,107,453k p=0.045 n=6
Parse Time 6.62s (± 0.16%) 6.60s (± 0.29%) ~ 6.58s 6.63s p=0.050 n=6
Bind Time 2.33s (± 0.35%) 2.33s (± 1.11%) ~ 2.30s 2.38s p=0.402 n=6
Check Time 70.87s (± 0.46%) 70.44s (± 1.19%) ~ 68.81s 71.07s p=0.378 n=6
Emit Time 0.14s (± 3.77%) 0.14s (± 3.77%) ~ 0.13s 0.14s p=1.000 n=6
Total Time 79.95s (± 0.41%) 79.52s (± 1.04%) ~ 77.93s 80.15s p=0.298 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,497 1,225,600 +103 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,459 261,473 +14 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 2,340,889k (± 0.04%) 2,340,282k (± 0.06%) ~ 2,338,128k 2,342,506k p=0.471 n=6
Parse Time 5.00s (± 0.47%) 5.01s (± 0.71%) ~ 4.97s 5.06s p=0.521 n=6
Bind Time 1.91s (± 0.61%) 1.91s (± 1.05%) ~ 1.90s 1.95s p=0.438 n=6
Check Time 34.14s (± 0.18%) 34.09s (± 0.54%) ~ 33.85s 34.42s p=0.199 n=6
Emit Time 2.62s (± 3.47%) 2.73s (± 4.84%) ~ 2.62s 2.92s p=0.230 n=6
Total Time 43.70s (± 0.25%) 43.76s (± 0.45%) ~ 43.53s 44.02s p=0.471 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,497 1,225,600 +103 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,459 261,473 +14 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 2,415,560k (± 0.03%) 2,424,751k (± 1.02%) ~ 2,413,186k 2,475,208k p=0.378 n=6
Parse Time 6.25s (± 0.42%) 6.30s (± 1.01%) ~ 6.25s 6.40s p=0.128 n=6
Bind Time 2.02s (± 0.68%) 2.03s (± 0.91%) ~ 2.01s 2.05s p=0.105 n=6
Check Time 40.87s (± 0.23%) 40.70s (± 0.31%) -0.17s (- 0.41%) 40.53s 40.91s p=0.031 n=6
Emit Time 3.15s (± 1.81%) 3.22s (± 5.31%) ~ 3.10s 3.55s p=1.000 n=6
Total Time 52.30s (± 0.24%) 52.25s (± 0.55%) ~ 52.00s 52.76s p=0.575 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,195 258,271 +76 (+ 0.03%) ~ ~ p=0.001 n=6
Types 104,737 104,741 +4 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 427,486k (± 0.01%) 427,508k (± 0.01%) ~ 427,444k 427,572k p=0.575 n=6
Parse Time 4.09s (± 0.84%) 4.08s (± 0.55%) ~ 4.05s 4.10s p=0.466 n=6
Bind Time 1.62s (± 1.63%) 1.63s (± 0.72%) ~ 1.62s 1.65s p=0.460 n=6
Check Time 22.01s (± 0.44%) 21.92s (± 0.46%) ~ 21.81s 22.07s p=0.173 n=6
Emit Time 1.54s (± 0.89%) 1.56s (± 1.26%) ~ 1.54s 1.59s p=0.241 n=6
Total Time 29.27s (± 0.32%) 29.19s (± 0.33%) ~ 29.06s 29.32s p=0.199 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,565 ~ ~ ~ p=1.000 n=6
Types 93,734 93,734 ~ ~ ~ p=1.000 n=6
Memory used 369,560k (± 0.04%) 369,531k (± 0.04%) ~ 369,325k 369,769k p=0.810 n=6
Parse Time 3.44s (± 0.94%) 3.46s (± 0.70%) ~ 3.42s 3.48s p=0.318 n=6
Bind Time 1.93s (± 0.91%) 1.94s (± 0.84%) ~ 1.92s 1.96s p=0.413 n=6
Check Time 19.18s (± 0.21%) 19.05s (± 0.36%) -0.13s (- 0.68%) 18.94s 19.13s p=0.005 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.55s (± 0.14%) 24.45s (± 0.30%) -0.10s (- 0.41%) 24.35s 24.55s p=0.030 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,884,756 2,884,738 -18 (- 0.00%) ~ ~ p=0.001 n=6
Types 976,437 976,437 ~ ~ ~ p=1.000 n=6
Memory used 3,047,809k (± 0.00%) 3,047,815k (± 0.00%) ~ 3,047,758k 3,047,886k p=0.810 n=6
Parse Time 16.92s (± 0.27%) 16.87s (± 0.19%) ~ 16.82s 16.89s p=0.125 n=6
Bind Time 5.23s (± 2.31%) 5.22s (± 2.35%) ~ 5.10s 5.33s p=0.464 n=6
Check Time 90.19s (± 2.15%) 90.25s (± 1.70%) ~ 89.06s 92.67s p=0.936 n=6
Emit Time 28.64s (± 6.52%) 28.22s (± 5.76%) ~ 26.02s 29.55s p=0.471 n=6
Total Time 140.97s (± 0.08%) 140.55s (± 0.33%) ~ 139.87s 141.32s p=0.066 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,117 267,158 +41 (+ 0.02%) ~ ~ p=0.001 n=6
Types 108,775 108,794 +19 (+ 0.02%) ~ ~ p=0.001 n=6
Memory used 411,616k (± 0.03%) 411,635k (± 0.02%) ~ 411,528k 411,763k p=0.575 n=6
Parse Time 4.71s (± 0.71%) 4.69s (± 0.31%) ~ 4.67s 4.71s p=0.567 n=6
Bind Time 2.09s (± 0.47%) 2.08s (± 0.71%) ~ 2.06s 2.10s p=0.241 n=6
Check Time 20.79s (± 0.28%) 20.81s (± 0.31%) ~ 20.75s 20.93s p=0.748 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.59s (± 0.22%) 27.58s (± 0.27%) ~ 27.53s 27.72s p=0.628 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 525,251 525,251 ~ ~ ~ p=1.000 n=6
Types 178,574 178,572 -2 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 462,922k (± 0.07%) 462,720k (± 0.09%) ~ 462,313k 463,235k p=0.378 n=6
Parse Time 3.18s (± 0.47%) 3.18s (± 0.83%) ~ 3.15s 3.22s p=0.935 n=6
Bind Time 1.17s (± 0.35%) 1.17s ~ ~ ~ p=0.405 n=6
Check Time 17.88s (± 0.20%) 17.91s (± 0.38%) ~ 17.78s 17.98s p=0.198 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.22s (± 0.14%) 22.26s (± 0.40%) ~ 22.10s 22.35s p=0.198 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
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

effect

tsconfig.json

tsconfig.build.json

tsconfig.base.json

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

hotwired/stimulus

tsconfig.test.json

tsconfig.json

@ahejlsberg
Copy link
Member Author

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 9, 2024

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
Copy link
Collaborator

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

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

effect

tsconfig.json

tsconfig.build.json

tsconfig.base.json

@typescript-bot
Copy link
Collaborator

@ahejlsberg
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 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 193,355k (± 0.96%) 194,039k (± 0.98%) ~ 192,140k 195,815k p=0.378 n=6
Parse Time 1.31s 1.31s (± 0.31%) ~ 1.30s 1.31s p=0.405 n=6
Bind Time 0.71s 0.71s ~ ~ ~ p=1.000 n=6
Check Time 9.41s (± 0.55%) 9.39s (± 0.15%) ~ 9.37s 9.41s p=0.517 n=6
Emit Time 2.76s (± 0.87%) 2.75s (± 0.51%) ~ 2.73s 2.77s p=0.514 n=6
Total Time 14.19s (± 0.26%) 14.16s (± 0.13%) ~ 14.13s 14.18s p=0.076 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,120 +6 (+ 0.00%) ~ ~ p=0.001 n=6
Types 407,050 407,047 -3 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 1,218,403k (± 0.00%) 1,218,399k (± 0.01%) ~ 1,218,283k 1,218,457k p=0.936 n=6
Parse Time 6.64s (± 0.74%) 6.66s (± 0.62%) ~ 6.61s 6.73s p=0.748 n=6
Bind Time 1.88s (± 0.43%) 1.85s (± 0.74%) -0.02s (- 1.15%) 1.84s 1.87s p=0.016 n=6
Check Time 30.66s (± 0.17%) 30.70s (± 0.45%) ~ 30.49s 30.84s p=0.520 n=6
Emit Time 13.58s (± 0.60%) 13.60s (± 0.34%) ~ 13.53s 13.66s p=0.624 n=6
Total Time 52.76s (± 0.19%) 52.81s (± 0.32%) ~ 52.61s 53.02s p=0.575 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,130,343 2,130,347 +4 (+ 0.00%) ~ ~ p=0.001 n=6
Types 927,684 927,683 -1 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,107,287k (± 0.01%) 2,107,310k (± 0.00%) ~ 2,107,199k 2,107,463k p=0.810 n=6
Parse Time 6.63s (± 0.28%) 6.63s (± 0.25%) ~ 6.60s 6.64s p=0.616 n=6
Bind Time 2.33s (± 1.01%) 2.33s (± 0.81%) ~ 2.30s 2.35s p=0.803 n=6
Check Time 70.37s (± 1.09%) 70.57s (± 1.38%) ~ 68.85s 71.84s p=0.630 n=6
Emit Time 0.14s (± 3.77%) 0.14s (± 4.05%) ~ 0.13s 0.14s p=0.640 n=6
Total Time 79.46s (± 0.95%) 79.66s (± 1.21%) ~ 77.97s 80.94s p=0.630 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,759 1,225,862 +103 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,509 261,524 +15 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 2,341,997k (± 0.06%) 2,340,957k (± 0.04%) ~ 2,339,729k 2,341,886k p=0.173 n=6
Parse Time 5.01s (± 0.93%) 5.01s (± 0.93%) ~ 4.96s 5.08s p=0.809 n=6
Bind Time 1.91s (± 0.77%) 1.92s (± 0.96%) ~ 1.90s 1.95s p=0.366 n=6
Check Time 34.10s (± 0.42%) 34.14s (± 0.38%) ~ 33.99s 34.35s p=0.575 n=6
Emit Time 2.58s (± 2.90%) 2.73s (± 6.47%) ~ 2.51s 2.92s p=0.173 n=6
Total Time 43.60s (± 0.34%) 43.80s (± 0.45%) ~ 43.46s 44.07s p=0.128 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,759 1,225,862 +103 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,509 261,524 +15 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 2,416,558k (± 0.03%) 2,415,664k (± 0.03%) ~ 2,414,363k 2,416,336k p=0.128 n=6
Parse Time 7.75s (± 0.63%) 7.71s (± 0.93%) ~ 7.62s 7.82s p=0.261 n=6
Bind Time 2.53s (± 1.08%) 2.52s (± 1.05%) ~ 2.48s 2.55s p=1.000 n=6
Check Time 50.07s (± 0.35%) 50.08s (± 0.24%) ~ 49.88s 50.20s p=0.689 n=6
Emit Time 3.86s (± 1.06%) 3.92s (± 1.61%) ~ 3.84s 4.01s p=0.078 n=6
Total Time 64.19s (± 0.23%) 64.23s (± 0.34%) ~ 64.00s 64.52s p=0.936 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,260 258,336 +76 (+ 0.03%) ~ ~ p=0.001 n=6
Types 104,772 104,777 +5 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 427,562k (± 0.01%) 427,614k (± 0.02%) ~ 427,512k 427,720k p=0.173 n=6
Parse Time 3.28s (± 0.59%) 3.30s (± 1.11%) ~ 3.26s 3.36s p=0.414 n=6
Bind Time 1.32s (± 1.47%) 1.32s (± 1.14%) ~ 1.30s 1.33s p=0.933 n=6
Check Time 17.80s (± 0.28%) 17.85s (± 0.43%) ~ 17.73s 17.96s p=0.198 n=6
Emit Time 1.25s (± 1.17%) 1.25s (± 1.28%) ~ 1.24s 1.28s p=0.932 n=6
Total Time 23.64s (± 0.34%) 23.71s (± 0.34%) ~ 23.60s 23.79s p=0.199 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,565 ~ ~ ~ p=1.000 n=6
Types 93,734 93,734 ~ ~ ~ p=1.000 n=6
Memory used 369,594k (± 0.04%) 369,534k (± 0.03%) ~ 369,421k 369,721k p=0.471 n=6
Parse Time 3.45s (± 0.87%) 3.45s (± 1.15%) ~ 3.41s 3.50s p=1.000 n=6
Bind Time 1.94s (± 0.51%) 1.95s (± 0.70%) ~ 1.93s 1.97s p=0.492 n=6
Check Time 19.09s (± 0.37%) 19.13s (± 0.50%) ~ 19.00s 19.28s p=0.572 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.48s (± 0.23%) 24.53s (± 0.30%) ~ 24.43s 24.64s p=0.296 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,884,910 2,884,892 -18 (- 0.00%) ~ ~ p=0.001 n=6
Types 976,550 976,550 ~ ~ ~ p=1.000 n=6
Memory used 3,047,986k (± 0.00%) 3,048,014k (± 0.00%) ~ 3,047,977k 3,048,048k p=0.936 n=6
Parse Time 16.92s (± 0.34%) 16.92s (± 0.36%) ~ 16.85s 17.01s p=0.873 n=6
Bind Time 5.22s (± 2.55%) 5.09s (± 0.24%) ~ 5.08s 5.11s p=0.052 n=6
Check Time 90.79s (± 2.70%) 92.48s (± 2.71%) ~ 89.29s 94.52s p=0.230 n=6
Emit Time 27.91s (± 6.90%) 26.24s (± 8.58%) ~ 24.31s 29.13s p=0.092 n=6
Total Time 140.84s (± 0.46%) 140.74s (± 0.22%) ~ 140.24s 141.11s p=0.936 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,117 267,158 +41 (+ 0.02%) ~ ~ p=0.001 n=6
Types 108,775 108,794 +19 (+ 0.02%) ~ ~ p=0.001 n=6
Memory used 411,564k (± 0.02%) 411,561k (± 0.01%) ~ 411,480k 411,638k p=1.000 n=6
Parse Time 3.83s (± 0.80%) 3.81s (± 0.81%) ~ 3.78s 3.87s p=0.369 n=6
Bind Time 1.68s (± 0.50%) 1.68s (± 0.32%) ~ 1.68s 1.69s p=0.855 n=6
Check Time 16.70s (± 0.52%) 16.77s (± 0.38%) ~ 16.68s 16.84s p=0.173 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.21s (± 0.34%) 22.26s (± 0.25%) ~ 22.17s 22.33s p=0.172 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 525,251 525,251 ~ ~ ~ p=1.000 n=6
Types 178,574 178,572 -2 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 462,553k (± 0.06%) 462,912k (± 0.09%) ~ 462,370k 463,324k p=0.229 n=6
Parse Time 3.94s (± 0.47%) 3.94s (± 0.25%) ~ 3.93s 3.95s p=0.933 n=6
Bind Time 1.46s (± 1.14%) 1.45s (± 1.12%) ~ 1.44s 1.48s p=0.507 n=6
Check Time 22.15s (± 0.39%) 22.23s (± 0.26%) ~ 22.12s 22.28s p=0.148 n=6
Emit Time 0.00s (±154.76%) 0.00s ~ ~ ~ p=0.174 n=6
Total Time 27.56s (± 0.32%) 27.62s (± 0.14%) ~ 27.55s 27.65s p=0.173 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
Copy link
Collaborator

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

Everything looks good!

@ahejlsberg
Copy link
Member Author

Tests are all clean and performance is unaffected. I think this is good to merge.

@@ -104,8 +104,8 @@ type Something = { foo: number };

// inference fails here, but ideally should not
const A = object<Something>()({
>A : ObjectType<Something>
> : ^^^^^^^^^^^^^^^^^^^^^
>A : any
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous type was better here but i guess maybe that relied on broken assumptions from the PR that got reverted

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, when we report circularity errors we also assign the error type, but the reverted PR sometimes didn't do that.

@babakks
Copy link
Contributor

babakks commented Jul 9, 2024

@ahejlsberg Thanks for this fix, and sorry my PR caused inconsistencies. ❤️

Copy link
Member

@RyanCavanaugh RyanCavanaugh left a comment

Choose a reason for hiding this comment

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

We should follow up on the change in effect. It looks correct on first glance but there might be some interplay with the outer contextual type in that example

@ahejlsberg
Copy link
Member Author

@RyanCavanaugh The effect change is just a switch to a better error message, similar to what you see in the compiler test suites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Backlog Bug PRs that fix a backlog bug For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
5 participants