Commit 2fe4d54
committed
Reject template property-keys (TS1136) and tighten enum members (TS1357)
Two grammar over-accepts, both from a failed declaration falling back to a
looser parse:
- A template literal as an object/class property key (`{ `b`: 321 }`) was
explicitly allowed by a `[Template, …]` branch in Prop. No valid JS/TS permits
a template property key (only ident/string/number/computed/#private), so the
branch is removed. A tagged template `obj.tag`s`` is unaffected (it parses as
a postfix expression, not a property key).
- An enum member followed by `:` (`enum E { a: 1 }`) was accepted because the
enum Decl failed on the `:` and fell back to parsing `enum` as an identifier
expression + `E` + a `{…}` block. Two fixes: forbid `enum` as a standalone
expression identifier (`[not('enum'), Ident]` — enum is reserved), and widen
EnumMember's name to MemberName (covers numeric/bigint/#private members) so the
enum Decl path remains the only parse and valid numeric-member enums still parse.
FP 103->95 (8 cases), FN stays 0 (3376/3376), TP unchanged. Artifacts regenerated.1 parent f3d5ca1 commit 2fe4d54
4 files changed
Lines changed: 10 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | 158 | | |
160 | 159 | | |
161 | | - | |
162 | 160 | | |
163 | | - | |
164 | 161 | | |
165 | 162 | | |
166 | 163 | | |
| |||
445 | 442 | | |
446 | 443 | | |
447 | 444 | | |
448 | | - | |
449 | | - | |
450 | 445 | | |
| 446 | + | |
451 | 447 | | |
452 | 448 | | |
453 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
157 | 155 | | |
158 | 156 | | |
159 | 157 | | |
| |||
177 | 175 | | |
178 | 176 | | |
179 | 177 | | |
180 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
| |||
416 | 417 | | |
417 | 418 | | |
418 | 419 | | |
419 | | - | |
| 420 | + | |
420 | 421 | | |
421 | 422 | | |
422 | 423 | | |
| |||
0 commit comments