test: cover compatibility method addition returns

This commit is contained in:
Hermes Agent
2026-09-12 20:28:46 +00:00
parent f921e2d77d
commit bbf1ad0b19
8 changed files with 40 additions and 3 deletions
+16
View File
@@ -297,6 +297,22 @@ The focused validation matrix keeps this valid arithmetic case beside the multip
The expression checker now gives operator-specific guidance for known TEXT operands in subtraction, multiplication, and division, including typed method return expressions. Broader expression inference remains future work.
Compatibility methods use the same arithmetic return checks as modern methods. This older spelling is accepted when a checked NUMBER parameter is used in a numeric addition:
```claro
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount + 2
LEARNED
ENDCLASS
NEW Player player
CALL player.score WITH 4
```
The focused validation matrix covers this positive compatibility example alongside subtraction, multiplication, and division.
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