Commit 469ba1f
Fix crash when inferring from tuple with middle rest and trailing variadic elements
When `getElementTypeOfSliceOfTupleType` returns `undefined` (because the
implied arity from the variadic constraint consumes the entire source
tuple), the result was passed directly to `inferFromTypes` via a non-null
assertion, causing a `TypeError: Cannot read properties of undefined
(reading 'aliasSymbol')` crash.
Add null checks before calling `inferFromTypes` in both the `[...T, ...rest]`
and `[...rest, ...T]` inference branches, consistent with the existing
pattern used in the single-rest-element branch.
Fixes #630051 parent 4f7b417 commit 469ba1f
File tree
4 files changed
+56
-3
lines changed- src/compiler
- tests
- baselines/reference
- cases/compiler
4 files changed
+56
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27422 | 27422 | | |
27423 | 27423 | | |
27424 | 27424 | | |
27425 | | - | |
| 27425 | + | |
| 27426 | + | |
| 27427 | + | |
| 27428 | + | |
27426 | 27429 | | |
27427 | 27430 | | |
27428 | 27431 | | |
| |||
27435 | 27438 | | |
27436 | 27439 | | |
27437 | 27440 | | |
27438 | | - | |
27439 | | - | |
| 27441 | + | |
| 27442 | + | |
| 27443 | + | |
| 27444 | + | |
27440 | 27445 | | |
27441 | 27446 | | |
27442 | 27447 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
0 commit comments