| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
When a union of literals generalizes to the same base type as its constituent check, elide the redundant child diagnostic on the error chain. Fixes microsoft#63050.
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Review effort: Lite
Findings: 2
Prevents redundant nested diagnostics when assignability checks on literal unions are generalized to the same base type, which previously caused the same assignability error to be emitted twice.
Changes:
| File | Description |
|---|---|
| tsc/internal/checker/relater.go | Drops a redundant child entry from the error chain when assignability/comparability diagnostics match. |
| tsc/testdata/tests/cases/compiler/literalUnionAssignabilityDoubleError.ts | New regression test reproducing the duplicate-error scenario. |
| tsc/testdata/baselines/reference/compiler/literalUnionAssignabilityDoubleError.errors.txt | New baseline verifying only one assignability error is emitted per site. |
| tsc/testdata/baselines/reference/compiler/literalUnionAssignabilityDoubleError.types | New type baseline for the added test. |
| tsc/testdata/baselines/reference/compiler/literalUnionAssignabilityDoubleError.symbols | New symbol baseline for the added test. |
| tsc/testdata/baselines/reference/compiler/literalUnionAssignabilityDoubleError.js | New emit baseline for the added test. |
| tsc/testdata/baselines/reference/compiler/typeOfOperator1.errors.txt | Baseline updated to remove duplicated nested error line. |
| tsc/testdata/baselines/reference/compiler/recursiveIndexedAccessSimplification.errors.txt | Baseline updated to remove duplicated nested error segments. |
| tsc/testdata/baselines/reference/compiler/complicatedIndexedAccessKeyofReliesOnKeyofNeverUpperBound.errors.txt | Baseline updated to remove repeated nested assignability chain lines. |
| tsc/testdata/baselines/reference/compiler/bigintPropertyName.errors.txt | Baseline updated to remove duplicated nested error line. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
| } | ||
| case diagnostics.Type_0_is_not_assignable_to_type_1, | ||
| diagnostics.Type_0_is_not_comparable_to_type_1: | ||
| if r.chainArgsMatch(generalizedSourceType, targetType) { |
| case diagnostics.Type_0_is_not_assignable_to_type_1, | ||
| diagnostics.Type_0_is_not_comparable_to_type_1: | ||
| if r.chainArgsMatch(generalizedSourceType, targetType) { | ||
| r.errorChain = r.errorChain.next | ||
| } |
| Back | FazBrowse Home | New Git URL |
Fixes #63050.
When relation error reporting generalizes a literal union to the same base type as its constituent check, the error chain ends up emitting the exact same assignability error twice. This elides the redundant child diagnostic when its arguments match the outer error.