Repository navigation
Fixed a crash related to variadic tuple elements with intersections containing InstantiableNonPrimitive - #64239
Conversation
…ontaining `InstantiableNonPrimitive`
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix handles the reported intersection case and includes matching regression coverage.
Pull request overview
Prevents recursive variadic tuple normalization from overflowing when intersections contain generic instantiable types.
Changes:
- Detects generic types within unions or intersections.
- Adds regression coverage for issue #63040 and expected baselines.
File summaries
| File | Description |
|---|---|
tsc/internal/checker/checker.go |
Updates tuple normalization and adds a contained-type helper. |
tsc/testdata/tests/cases/compiler/recursiveConditionalCrash5.ts |
Adds the crash regression case. |
tsc/testdata/baselines/reference/compiler/recursiveConditionalCrash5.errors.txt |
Records the expected diagnostic. |
tsc/testdata/baselines/reference/compiler/recursiveConditionalCrash5.types |
Records inferred types. |
tsc/testdata/baselines/reference/compiler/recursiveConditionalCrash5.symbols |
Records resolved symbols. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| return f(t) | ||
| } | ||
|
|
||
| func someContainedType(t *Type, f func(*Type) bool) bool { |
There was a problem hiding this comment.
Interesting, we don't have this helper already?
There was a problem hiding this comment.
No. I think I was adding this at least twice in various PRs though but they didn't get in at the time :P
|
This fixes something I found in #65064. Here's a test case I think should be added: type Spread<T extends readonly unknown[]> = [0, ...(T & readonly unknown[])];
type A = Spread<[1, 2]>;
type Tagged<T extends unknown[]> = [0, ...(T & { tag?: 1 })];
type B = Tagged<string[]>;
declare function f<T extends unknown[]>(x: T): [0, ...(T & { tag?: 1 })];
const c = f([1, "a"] as [1, "a"]);On main these all come out as |
fixes #63040
recreates #63128