test: cover compatibility unknown field annotations

This commit is contained in:
Hermes Agent
2026-09-15 17:06:45 +00:00
parent 304c43ba45
commit f7452c119c
6 changed files with 20 additions and 0 deletions
+1
View File
@@ -112,6 +112,7 @@ OBJECT FIELDS player AS fields
Inside a method, an inline field type must agree with the class declaration. For example, `HAS score NUMBER` must not be assigned with `SET score TEXT 10`; `claro typecheck` explains the conflict and suggests `NUMBER`. The same check applies to older `TEACH ... TAKES ...` / `LEARNED` methods, so compatibility lessons get the same feedback.
If an inline method-field annotation is not a Claro type, `claro typecheck` names the field and method and suggests the class declaration. For example, `SET score AS BANANA TO 10` reports that `BANANA` is unknown and recommends `NUMBER`.
The same diagnostic is covered for older `TEACH ... TAKES ...` / `LEARNED` methods, so compatibility lessons do not silently accept misspelled field types.
## Static type safety