Repository navigation
Make computed property names always checked, regardless of parent grammar errors - #64674
Conversation
|
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. |
There was a problem hiding this comment.
🟡 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
| if computedName != nil { | ||
| if ast.IsEnumMember(computedName.Parent) { | ||
| return | ||
| } | ||
| if isInvalidComputedPropertyName(computedName) { | ||
| return |
Daniel Rosenwasser (DanielRosenwasser)
left a comment
There was a problem hiding this comment.
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.
Jake Bailey (jakebailey)
left a comment
There was a problem hiding this comment.
LGTM, but can reapprove if the test names are changing
|
TypeScript Bot (@typescript-bot) test it |
|
Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready. Everything looks the same! |
|
Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing Everything looks good! |
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing Everything looks good! |

Fixes a source of flaky diags that can be hidden from
.d.tsauthors with overliberal use ofskipLibCheck.