test: cover compatibility unknown field annotations
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user