Repository navigation
Fix issue related to canonicalization of type references in relation caches - #65754
Anders Hejlsberg (ahejlsberg) wants to merge 3 commits into
Conversation
|
TypeScript Bot (@typescript-bot) test it |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the type-reference canonicalization change.
No open issues 🎉
What changed in this PR
Fixes #65752 by tightening type-reference canonicalization in the compiler’s relation caches, preventing earlier comparisons from incorrectly affecting later results.
Changes:
- Restricts canonicalization to references whose arguments can be safely represented.
- Adds regression coverage for assignability and overload selection.
- Updates recursive-type diagnostics to agree across checking orders.
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/canonicalTypeReferences.ts |
Adds cache-reuse regression cases. |
tsc/testdata/baselines/reference/compiler/typeReferenceRecursionIdentityCheckOrder(checkorder=typesfirst).errors.txt |
Updates types-first diagnostics. |
tsc/testdata/baselines/reference/compiler/typeReferenceRecursionIdentityCheckOrder(checkorder=default).errors.txt |
Records consistent default-order errors. |
tsc/testdata/baselines/reference/compiler/canonicalTypeReferences.types |
Records expected types and overload results. |
tsc/testdata/baselines/reference/compiler/canonicalTypeReferences.symbols |
Records regression-test symbols. |
tsc/testdata/baselines/reference/compiler/canonicalTypeReferences.errors.txt |
Records the rejected unsafe assignment. |
tsc/internal/checker/checker.go |
Tightens canonicalization eligibility and removes unused helpers. |
Review effort: Balanced
|
Hey Anders Hejlsberg (@ahejlsberg), it looks like the DT test run failed. Please check the log for more details. |
|
Anders Hejlsberg (@ahejlsberg) Here are the results of running the user tests with tsc comparing Everything looks good! |
|
Anders Hejlsberg (@ahejlsberg) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Anders Hejlsberg (@ahejlsberg) Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
|
Here's another case that still collides: interface Box<A> {
readonly a: A;
}
function f<T, U extends T, V>(u: Box<U>, v: Box<V>) {
const ok: Box<T> = u;
const bad: Box<V> = u; // no error unless you delete the line above
}
FWIW, always keying on the actual types seems perf neutral on xstate/vscode. |
See reasoning here. This also fixes a type ordering bug that was caused by the same issue.
Fixes #65752.