Skip to content

Make computed property names always checked, regardless of parent grammar errors - #64674

Merged
Wesley Wigham (weswigham) merged 5 commits into
microsoft:mainfrom
weswigham:diag-investigations
Oct 7, 2026
Merged

Wesley Wigham (weswigham) merged 5 commits into
microsoft:mainfrom
weswigham:diag-investigations

Conversation

@weswigham

Copy link
Copy Markdown
Member

Fixes a source of flaky diags that can be hidden from .d.ts authors with overliberal use of skipLibCheck.

@weswigham

Wesley Wigham (weswigham) commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

In theory this could fix most of the flakes reported in insiders telemetry, but in practice I doubt it does - this flakiness could mask basically any diagnostic code, since we were just skipping a subtree entirely (which then gets checked when emit asks questions about it to do its' best, anyway). We'll have to see what we start getting in after this.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The alias-retention behavior changed in the checker lacks a regression test using an imported value.

1 open finding
What changed in this PR

Ensures expressions in invalid enum computed property names are still semantically checked, preventing diagnostics from depending on declaration-checking order.

Changes:

  • Checks enum computed-name expressions.
  • Enables alias reference tracking within those expressions.
  • Adds regression tests and updates diagnostic baselines.
File Description
tsc/​internal/​checker/​checker.go Checks computed enum names and tracks aliases.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnostic6385.ts Tests deprecation suggestions.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnostic6133SkippedExpression.ts Tests unused-local tracking.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnostic2695.ts Tests comma-expression diagnostics.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnostic2552.ts Tests spelling suggestions.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnostic2356.ts Tests invalid arithmetic diagnostics.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnostic2322EnumComputedName.ts Tests nested assignment diagnostics.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnostic2307.ts Tests unresolved-module diagnostics.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnostic2304.ts Tests unresolved-name diagnostics.
tsc/​testdata/​tests/​cases/​compiler/​flakyDiagnostic1038.ts Tests nested grammar diagnostics.
tsc/​testdata/​baselines/​reference/​conformance/​parserES5ComputedPropertyName6(target=es2015).errors.txt Updates expected diagnostics.
tsc/​testdata/​baselines/​reference/​conformance/​parserComputedPropertyName34.errors.txt Updates expected diagnostics.
tsc/​testdata/​baselines/​reference/​conformance/​parserComputedPropertyName30.errors.txt Updates expected diagnostics.
tsc/​testdata/​baselines/​reference/​conformance/​parserComputedPropertyName26.errors.txt Updates expected diagnostics.
tsc/​testdata/​baselines/​reference/​conformance/​parserComputedPropertyName16.errors.txt Updates expected diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic6385.types Records inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic6385.symbols Records resolved symbols.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic6385.js Records emitted output.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic6385.errors.txt Records expected diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic6133SkippedExpression.types Records inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic6133SkippedExpression.symbols Records resolved symbols.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic6133SkippedExpression.js Records emitted output.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic6133SkippedExpression.errors.txt Records expected diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2695.types Records inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2695.symbols Records resolved symbols.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2695.js Records emitted output.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2695.errors.txt Records expected diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2552.types Records inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2552.symbols Records resolved symbols.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2552.js Records emitted output.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2552.errors.txt Records expected diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2356.types Records inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2356.symbols Records resolved symbols.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2356.js Records emitted output.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2356.errors.txt Records expected diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2322EnumComputedName.types Records inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2322EnumComputedName.symbols Records resolved symbols.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2322EnumComputedName.js Records emitted output.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2322EnumComputedName.errors.txt Records expected diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2307.types Records inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2307.symbols Records resolved symbols.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2307.js Records emitted output.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2307.errors.txt Records expected diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2304.types Records inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2304.symbols Records resolved symbols.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2304.js Records emitted output.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic2304.errors.txt Records expected diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic1038.types Records inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic1038.symbols Records resolved symbols.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic1038.js Records emitted output.
tsc/​testdata/​baselines/​reference/​compiler/​flakyDiagnostic1038.errors.txt Records expected diagnostics.

🧠 Review effort: Balanced

Comment on lines 28793 to 28795
if computedName != nil {
if ast.IsEnumMember(computedName.Parent) {
return
}
if isInvalidComputedPropertyName(computedName) {
return

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.

I don't really like the naming flakyDiagnostic... - though it is fine to comment that that's the reason @declaration is being specified in the test case.

@jakebailey Jake 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, but can reapprove if the test names are changing

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test it

@typescript-automation

typescript-automation Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

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-automation

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-automation

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing baseline and pr:

Everything looks good!

@typescript-automation

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey)
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 - native
Errors 41 41 ~ ~ ~ p=1.000 n=12
Symbols 115,276 115,276 ~ ~ ~ p=1.000 n=12
Types 79,613 79,613 ~ ~ ~ p=1.000 n=12
Memory Used 139,439k (± 0.07%) 139,418k (± 0.05%) ~ 139,288k 139,665k p=0.755 n=12
Memory Allocs 2,190,665 (± 0.01%) 2,190,688 (± 0.01%) ~ 2,190,405 2,191,011 p=0.671 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.040s (± 3.28%) 0.041s (± 2.75%) ~ 0.039s 0.044s p=0.447 n=12
Bind Time 0.013s (±11.66%) 0.012s (±10.18%) ~ 0.010s 0.016s p=0.966 n=12
Check Time 0.497s (± 0.77%) 0.505s (± 0.59%) +0.008s (+ 1.57%) 0.497s 0.513s p=0.003 n=12
Emit Time 0.274s (± 2.20%) 0.277s (± 2.41%) ~ 0.266s 0.299s p=0.744 n=12
Total Time 0.832s (± 0.86%) 0.843s (± 0.77%) +0.011s (+ 1.29%) 0.827s 0.858s p=0.027 n=12
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=12
Symbols 845,540 (± 0.07%) 845,715 (± 0.06%) ~ 844,246 846,767 p=0.843 n=12
Types 248,125 (± 0.00%) 248,124 (± 0.00%) ~ 248,122 248,125 p=0.065 n=12
Memory Used 784,279k (± 0.02%) 784,327k (± 0.02%) ~ 783,909k 784,703k p=0.788 n=12
Memory Allocs 12,839,061 (± 0.01%) 12,840,604 (± 0.01%) ~ 12,837,522 12,846,017 p=0.198 n=12
Config Time 0.016s (± 1.90%) 0.017s (± 1.99%) ~ 0.016s 0.017s p=0.680 n=12
Parse Time 0.260s (± 2.06%) 0.259s (± 2.41%) ~ 0.241s 0.271s p=0.854 n=12
Bind Time 0.059s (± 0.64%) 0.062s (± 6.50%) ~ 0.058s 0.080s p=0.293 n=12
Check Time 0s 0s ~ ~ ~ p=1.000 n=12
Emit Time 1.590s (± 0.73%) 1.591s (± 0.81%) ~ 1.566s 1.640s p=0.977 n=12
Total Time 1.936s (± 0.66%) 1.939s (± 0.64%) ~ 1.910s 1.975s p=0.619 n=12
mui-docs - native
Errors 11,405 11,405 ~ ~ ~ p=1.000 n=12
Symbols 4,359,614 4,359,614 ~ ~ ~ p=1.000 n=12
Types 1,376,379 1,376,379 ~ ~ ~ p=1.000 n=12
Memory Used 2,955,992k (± 0.06%) 2,955,102k (± 0.04%) ~ 2,951,977k 2,958,209k p=0.630 n=12
Memory Allocs 32,859,790 (± 0.04%) 32,834,756 (± 0.06%) ~ 32,773,067 32,876,789 p=0.052 n=12
Config Time 0.017s (± 1.07%) 0.017s (± 1.99%) ~ 0.016s 0.017s p=0.069 n=12
Parse Time 0.495s (± 3.40%) 0.491s (± 3.63%) ~ 0.429s 0.520s p=0.843 n=12
Bind Time 0.002s 0.002s ~ ~ ~ p=1.000 n=12
Check Time 8.571s (± 0.37%) 8.617s (± 0.52%) ~ 8.524s 8.724s p=0.164 n=12
Emit Time 0.553s (±14.64%) 0.499s (±14.77%) ~ 0.416s 0.682s p=0.830 n=12
Total Time 10.404s (± 0.61%) 10.390s (± 0.60%) ~ 10.243s 10.529s p=0.745 n=12
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,390,229 1,390,229 ~ ~ ~ p=1.000 n=12
Types 441,498 441,498 ~ ~ ~ p=1.000 n=12
Memory Used 1,686,651k (± 1.01%) 1,678,356k (± 0.94%) ~ 1,650,438k 1,716,582k p=0.319 n=12
Memory Allocs 92,226,704 (± 0.09%) 92,176,064 (± 0.14%) ~ 91,796,122 92,407,374 p=0.713 n=12
Config Time 0.003s (±14.59%) 0.003s (±14.59%) ~ 0.002s 0.004s p=1.000 n=12
Parse Time 0.203s (± 3.74%) 0.196s (± 4.40%) ~ 0.182s 0.226s p=0.192 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.817s (± 0.46%) 1.828s (± 0.63%) ~ 1.807s 1.867s p=0.235 n=12
Emit Time 0.287s (± 5.27%) 0.295s (± 5.05%) ~ 0.243s 0.324s p=0.418 n=12
Total Time 23.523s (± 0.68%) 23.649s (± 0.79%) ~ 23.120s 24.055s p=0.242 n=12
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 334,953 334,953 ~ ~ ~ p=1.000 n=12
Types 197,616 197,616 ~ ~ ~ p=1.000 n=12
Memory Used 313,231k (± 0.02%) 313,206k (± 0.04%) ~ 312,936k 313,521k p=0.799 n=12
Memory Allocs 4,623,734 (± 0.01%) 4,623,217 (± 0.01%) -517 (- 0.01%) 4,622,372 4,624,442 p=0.039 n=12
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=12
Parse Time 0.117s (± 5.36%) 0.112s (± 3.06%) ~ 0.104s 0.122s p=0.247 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.053s (± 0.37%) 1.059s (± 0.39%) +0.006s (+ 0.56%) 1.048s 1.072s p=0.039 n=12
Emit Time 0.131s (±11.01%) 0.123s (±12.65%) ~ 0.095s 0.153s p=0.400 n=12
Total Time 1.352s (± 0.79%) 1.349s (± 0.97%) ~ 1.324s 1.388s p=0.541 n=12
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=12
Symbols 303,834 303,834 ~ ~ ~ p=1.000 n=12
Types 181,663 181,663 ~ ~ ~ p=1.000 n=12
Memory Used 273,897k (± 0.02%) 273,931k (± 0.02%) ~ 273,816k 274,123k p=0.418 n=12
Memory Allocs 1,616,111 (± 0.01%) 1,615,959 (± 0.02%) ~ 1,615,393 1,616,532 p=0.378 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.096s (± 3.27%) 0.099s (± 4.22%) ~ 0.087s 0.110s p=0.296 n=12
Bind Time 0.039s (±10.82%) 0.038s (±10.37%) ~ 0.030s 0.048s p=0.619 n=12
Check Time 0.822s (± 0.38%) 0.831s (± 0.54%) +0.009s (+ 1.07%) 0.821s 0.841s p=0.002 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 0.972s (± 0.80%) 0.983s (± 0.87%) ~ 0.967s 1.007s p=0.057 n=12
vscode - native
Errors 380 380 ~ ~ ~ p=1.000 n=12
Symbols 10,938,788 10,938,788 ~ ~ ~ p=1.000 n=12
Types 3,629,325 3,629,325 ~ ~ ~ p=1.000 n=12
Memory Used 7,038,564k (± 0.02%) 7,039,654k (± 0.02%) ~ 7,035,529k 7,043,456k p=0.291 n=12
Memory Allocs 54,035,557 (± 0.02%) 54,041,214 (± 0.03%) ~ 54,023,328 54,120,284 p=0.443 n=12
Config Time 0.073s (± 0.52%) 0.073s (± 0.42%) ~ 0.073s 0.074s p=0.278 n=12
Parse Time 1.827s (± 3.10%) 1.830s (± 3.15%) ~ 1.682s 1.949s p=0.932 n=12
Bind Time 0.555s (±20.82%) 0.528s (±14.43%) ~ 0.446s 0.787s p=0.765 n=12
Check Time 14.231s (± 1.21%) 14.189s (± 1.10%) ~ 13.820s 14.472s p=0.810 n=12
Emit Time 5.077s (± 9.43%) 5.191s (±10.35%) ~ 4.129s 6.226s p=0.601 n=12
Total Time 21.844s (± 1.81%) 21.897s (± 1.87%) ~ 21.073s 22.646s p=0.671 n=12
webpack - native
Errors 589 589 ~ ~ ~ p=1.000 n=12
Symbols 1,290,065 1,290,065 ~ ~ ~ p=1.000 n=12
Types 601,747 601,747 ~ ~ ~ p=1.000 n=12
Memory Used 995,597k (± 0.02%) 995,634k (± 0.02%) ~ 994,763k 996,118k p=0.590 n=12
Memory Allocs 6,461,739 (± 0.02%) 6,461,371 (± 0.02%) ~ 6,457,893 6,464,962 p=0.843 n=12
Config Time 0.009s 0.009s ~ ~ ~ p=1.000 n=12
Parse Time 0.279s (± 2.47%) 0.286s (± 2.91%) ~ 0.261s 0.306s p=0.192 n=12
Bind Time 0.090s (±15.63%) 0.078s (±18.12%) ~ 0.063s 0.121s p=0.310 n=12
Check Time 1.964s (± 0.54%) 1.959s (± 0.49%) ~ 1.938s 1.993s p=0.340 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 2.378s (± 0.77%) 2.367s (± 0.84%) ~ 2.335s 2.430s p=0.355 n=12
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,055,452 1,055,452 ~ ~ ~ p=1.000 n=12
Types 386,738 386,738 ~ ~ ~ p=1.000 n=12
Memory Used 613,159k (± 0.02%) 613,234k (± 0.02%) ~ 612,880k 613,479k p=0.319 n=12
Memory Allocs 4,862,087 (± 0.10%) 4,862,777 (± 0.11%) ~ 4,846,537 4,871,446 p=0.799 n=12
Config Time 0.003s 0.003s (± 6.23%) ~ 0.002s 0.003s p=1.000 n=12
Parse Time 0.144s (± 3.83%) 0.143s (± 3.79%) ~ 0.128s 0.155s p=0.831 n=12
Bind Time 0.043s (±17.99%) 0.042s (±18.10%) ~ 0.032s 0.068s p=0.722 n=12
Check Time 1.147s (± 0.70%) 1.149s (± 0.84%) ~ 1.129s 1.182s p=0.943 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.346s (± 0.91%) 1.344s (± 0.77%) ~ 1.319s 1.372s p=0.787 n=12
System info unknown
Hosts
  • native
Scenarios
  • Compiler-Unions - native
  • angular-1 - native
  • mui-docs - native
  • strada-build-src - native
  • strada-compiler - native
  • ts-pre-modules - native
  • vscode - native
  • webpack - native
  • xstate-main - native
Benchmark Name Iterations
Current pr 12
Baseline baseline 12

Developer Information:

Download Benchmarks

@weswigham
Wesley Wigham (weswigham) added this pull request to the merge queue Oct 7, 2026
Merged via the queue into microsoft:main with commit ec47d33 Oct 7, 2026
29 checks passed
@weswigham
Wesley Wigham (weswigham) deleted the diag-investigations branch October 7, 2026 23:22
@typescript-automation

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing baseline and pr:

Everything looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants