test: cover compatibility method subtraction diagnostics

This commit is contained in:
Hermes Agent
2026-09-13 00:36:05 +00:00
parent 747e8156e0
commit 0ee528d9ae
7 changed files with 41 additions and 2 deletions
+19
View File
@@ -333,6 +333,25 @@ CALL player.score WITH 4
The focused validation matrix covers this positive compatibility example alongside subtraction, multiplication, and division.
The same operator-specific diagnostic is covered for older compatibility methods:
```claro
CLASS Player
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount - "oops"
LEARNED
ENDCLASS
```
Claro reports:
```text
Type mismatch for return from Player.total: subtraction needs NUMBER values, but "oops" looks like TEXT.
```
This keeps `TAKES` / `LEARNED` lessons aligned with the modern method syntax.
Text concatenation is also accepted when the result is assigned to a TEXT field. This keeps a common beginner pattern type-safe without treating every `+` expression as numeric:
```claro