Repository navigation
Commit 231bc62
committed
Check computed enum initializers when checking the member
Computing the values of an enum's members type-checked each computed
initializer to report one that is not a number. The initializer may
refer to the enum itself, whose type then reads member values that are
still being computed, so the enum's type depended on whether its values
were first computed by checking it or by asking for its type.
The values do not depend on the initializer's type, so the check now
happens when the member is checked, as for any other error in an
initializer.1 parent fecdfb8 commit 231bc62
2 files changed
Lines changed: 6 additions & 5 deletions
File tree
- tsc
- internal/checker
- testdata/baselines/reference/compiler
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5275 | 5275 | | |
5276 | 5276 | | |
5277 | 5277 | | |
5278 | | - | |
5279 | | - | |
| 5278 | + | |
| 5279 | + | |
| 5280 | + | |
| 5281 | + | |
| 5282 | + | |
5280 | 5283 | | |
5281 | 5284 | | |
5282 | 5285 | | |
| |||
25154 | 25157 | | |
25155 | 25158 | | |
25156 | 25159 | | |
25157 | | - | |
25158 | | - | |
25159 | 25160 | | |
25160 | 25161 | | |
25161 | 25162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments