test: cover lowercase compatibility method returns

This commit is contained in:
Hermes Agent
2026-09-10 21:07:18 +00:00
parent 57db2ba3e2
commit 04a6476960
5 changed files with 29 additions and 2 deletions
+16
View File
@@ -68,6 +68,22 @@ END
This reports a normal return mismatch naming `NUMBER` and `TEXT`; capitalization style does not disable the safety check.
The same case-insensitive return declaration rule applies to compatibility methods. A lowercase `returns` still checks the method's `RETURN` value:
```claro
CLASS Player
TEACH score TAKES amount returns NUMBER
RETURN "oops"
LEARNED
END
```
`claro typecheck` reports:
```text
Type mismatch for return from Player.score: expected NUMBER, but this value looks like TEXT.
```
When a function declares a return type, `claro typecheck` accepts nested conditionals when every branch returns a value of that type:
```claro