Repository navigation
Commit 5a79252
committed
Track computed property name cycles on the resolution stack
A computed property name stored a placeholder type while its
expression was checked, and returned the placeholder when re-entered.
That kept the cycle off the resolution stack, so the computations in
between did not fail, and the placeholder `{}` escaped into messages
when checking entered through the property name, while `any` did when
it entered through the variable it references. In
blockScopedBindingUsedBeforeDef, the error read "Type '{}' cannot be
used as an index type" or "Type 'any' ..." depending on what was
checked first.
Resolve computed property names on the resolution stack, failing with
the error type on re-entry like other circular resolutions.1 parent 620f184 commit 5a79252
2 files changed
Lines changed: 18 additions & 8 deletions
File tree
- tsc
- internal/checker
- testdata/baselines/reference/compiler
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
19432 | 19433 | | |
19433 | 19434 | | |
19434 | 19435 | | |
| 19436 | + | |
| 19437 | + | |
19435 | 19438 | | |
19436 | 19439 | | |
19437 | 19440 | | |
| |||
27749 | 27752 | | |
27750 | 27753 | | |
27751 | 27754 | | |
27752 | | - | |
27753 | 27755 | | |
27754 | 27756 | | |
27755 | 27757 | | |
27756 | 27758 | | |
27757 | | - | |
| 27759 | + | |
| 27760 | + | |
| 27761 | + | |
| 27762 | + | |
| 27763 | + | |
| 27764 | + | |
| 27765 | + | |
| 27766 | + | |
| 27767 | + | |
27758 | 27768 | | |
27759 | 27769 | | |
27760 | 27770 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
0 commit comments