typecheck: diagnose unknown method check fields

This commit is contained in:
Hermes Agent
2026-09-14 07:36:08 +00:00
parent ae6c261156
commit 7064343cee
6 changed files with 18 additions and 3 deletions
+2
View File
@@ -854,3 +854,5 @@ The same method-aware diagnostic is used when a method directly assigns the wron
This is currently a static checker feature. It improves `claro typecheck` and validation confidence for `DO` and compatibility `CALL ... WITH` function calls, simple `DO object.method ...` calls where the object was created with `NEW Class name`, and direct assignments to known object fields. Runtime enforcement for every container mutation and richer function/object signatures can be added later after the syntax is classroom-tested.
Method-body field assignments are covered in both modern and compatibility syntax, including a valid YESNO assignment through `TEACH toggle TAKES value` and `CALL player.toggle WITH YES`. Method-body `CHECK TYPE` metadata has the same balanced coverage: a modern `DO player.toggle YES` example and the compatibility `CALL` example both verify a declared YESNO field. The focused release validator keeps these positive examples beside the wrong-type diagnostics.
A bare field typo inside a method's `CHECK TYPE` is also checked now. For example, `CHECK TYPE level IS NUMBER` in `Player.train` reports `Object Player has no field level. Check the field name or add HAS level NUMBER to the class.` This keeps method metadata checks consistent with direct method-field assignments and uses the expected type to make the repair actionable.