typecheck: reject duplicate object names

This commit is contained in:
Hermes Agent
2026-09-16 07:38:22 +00:00
parent c713d2b86e
commit bb21a1e3a4
6 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -183,7 +183,7 @@ Object methods must also have unique names within their class. If `CLASS Player`
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 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.
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.
Simple functions and object methods can also declare a return type. `claro typecheck` checks each `RETURN` expression against it and reports a missing return when a declaration never returns a value: