typecheck: reject unknown class field types
This commit is contained in:
@@ -187,7 +187,7 @@ The same declaration check applies to object methods in both syntax styles. For
|
||||
|
||||
Object methods must also have unique names within their class. If `CLASS Player` declares `TEACH show` twice, `claro typecheck` reports `Method Player.show is declared more than once. Give each method a different name.` Rename one method before calling it.
|
||||
|
||||
Class fields must also have unique names. If `CLASS Player` declares `HAS score NUMBER` twice, or declares the same field with another type, `claro typecheck` reports `Class Player declares field score more than once. Give each field a different name.` Keep one `HAS` line for each field.
|
||||
Class fields must also have unique names and known types. If `CLASS Player` declares `HAS score NUMBER` twice, or declares the same field with another type, `claro typecheck` reports `Class Player declares field score more than once. Give each field a different name.` If a field uses an unknown type such as `BANANA`, it reports `Class Player field score uses an unknown type BANANA. Use a Claro type such as NUMBER, TEXT, YESNO, LIST, or MAP.` Keep one `HAS` line for each field and use a supported type.
|
||||
|
||||
Class names must also be unique. If a file declares `CLASS Player` twice, `claro typecheck` reports `Class Player is declared more than once. Give each class a different name.` Rename one class before creating its objects. Object names must also be unique within a script: creating `NEW Player player` twice reports `Object player is created more than once. Give each object a different name.` Use a different object name for the second instance.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user