typecheck: diagnose unknown NEW classes
This commit is contained in:
@@ -109,6 +109,12 @@ OBJECT CLASS player AS kind
|
||||
OBJECT FIELDS player AS fields
|
||||
```
|
||||
|
||||
When a script already declares classes, `claro typecheck` also catches a typo in a `NEW` class name and explains how to repair it:
|
||||
|
||||
```text
|
||||
Class Plaeyr is not known yet. Check the class name or declare CLASS Plaeyr before creating player.
|
||||
```
|
||||
|
||||
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`.
|
||||
|
||||
Reference in New Issue
Block a user