typecheck: reject extra short field tokens

This commit is contained in:
Hermes Agent
2026-09-21 09:33:21 +00:00
parent 72a5589a3e
commit 44937b074f
7 changed files with 28 additions and 3 deletions
+11 -1
View File
@@ -825,7 +825,7 @@ SET player.score AS NUMBER TO 10
Both explicit forms must agree with the class field declaration.
The separated form accepts one value expression only. Extra words are rejected
Each explicit field annotation accepts one value expression only. Extra words are rejected
with a repair hint instead of being silently ignored:
```claro
@@ -836,6 +836,16 @@ SET player.score AS NUMBER TO 10 extra
SET player.score has extra text after value 10. Keep only the field name, type, TO, and one expression.
```
The short explicit form is checked too:
```claro
SET player.score NUMBER 10 extra
```
```text
SET player.score has extra text after value 10. Keep only the field name, type, and one expression.
```
The `AS ... TO` spelling also works inside modern and compatibility object methods:
```claro