typecheck: name method field check diagnostics

This commit is contained in:
Hermes Agent
2026-09-13 15:04:31 +00:00
parent ae41341a7d
commit d690ff5a0f
9 changed files with 38 additions and 4 deletions
+1 -1
View File
@@ -345,7 +345,7 @@ The same missing-object guidance is now validated for direct field assignment be
Object player is not known yet. Create it with NEW ClassName player before setting player.score.
```
The checker also names typed method-body field assignments. Inside `Player.rename`, `SET name 123` reports `Type mismatch for field name in Player.rename: expected TEXT, but this value looks like NUMBER.` Inside `Player.add RETURNS NUMBER`, `SET score score + name` reports `Type mismatch for field score in Player.add: addition needs NUMBER values, but name looks like TEXT.` so the learner sees that the field belongs to the current class method, not an unrelated variable.
The checker also names typed method-body field checks and assignments. Inside `Player.rename`, `CHECK TYPE name IS NUMBER` reports `Type check failed in Player.rename: expected NUMBER, but name looks like TEXT.` Inside `Player.rename`, `SET name 123` reports `Type mismatch for field name in Player.rename: expected TEXT, but this value looks like NUMBER.` Inside `Player.add RETURNS NUMBER`, `SET score score + name` reports `Type mismatch for field score in Player.add: addition needs NUMBER values, but name looks like TEXT.` so the learner sees that the field belongs to the current class method, not an unrelated variable.
## Project and package workflow