typecheck: diagnose unknown NEW classes

This commit is contained in:
Hermes Agent
2026-09-16 13:50:00 +00:00
parent 7eff213a78
commit 139838d56e
7 changed files with 25 additions and 2 deletions
+8
View File
@@ -715,6 +715,14 @@ Output:
Object Player has no method fly. Check the method name or add TEACH fly inside CLASS Player.
```
When a script declares classes, `NEW` also checks that the requested class exists. A typo such as `NEW Plaeyr player` receives a repair hint:
```text
Class Plaeyr is not known yet. Check the class name or declare CLASS Plaeyr before creating player.
```
For backward compatibility, a script with no `CLASS` declarations keeps the older permissive `NEW` behavior.
## Object field assignment checks
Claro also has a narrow static diagnostic for direct object-field assignments. If a class declares a typed field and a script creates a simple object with `NEW Class name`, `claro typecheck` remembers the field type: