typecheck: diagnose missing function names

This commit is contained in:
Hermes Agent
2026-09-17 04:21:38 +00:00
parent b59945b14f
commit 649b327f52
7 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -183,7 +183,7 @@ If a function repeats a parameter name, `claro typecheck` reports the declaratio
Function greet declares parameter name more than once. Give each parameter a different name.
```
Top-level functions must also have unique names. If a script declares `TEACH greet` twice, `claro typecheck` reports `Function greet is declared more than once. Give each function a different name.` Rename one function before calling it.
Top-level functions must also have unique names. If a script declares `TEACH greet` twice, `claro typecheck` reports `Function greet is declared more than once. Give each function a different name.` Rename one function before calling it. A function declaration must include a name; writing only `TEACH` reports `TEACH needs a function name. Add a name after TEACH, such as TEACH greet.`
The same declaration check applies to object methods in both syntax styles. For example, `TEACH greet name, name` inside `CLASS Player` reports `Method Player.greet declares parameter name more than once. Give each parameter a different name.` Duplicate method names are also rejected in both modern `END` methods and compatibility `TAKES` / `LEARNED` methods, with a rename hint before a call can become ambiguous.