typecheck: preserve text operands in arithmetic diagnostics

This commit is contained in:
Hermes Agent
2026-09-07 04:28:03 +00:00
parent 2e990a4b00
commit 2cf5aaf3a9
7 changed files with 32 additions and 1 deletions
+12
View File
@@ -89,6 +89,18 @@ Type mismatch for field backup.score: expected NUMBER, but this value looks like
This remains limited to direct assignments through simple alias chains; control-flow and complex object-flow analysis are still planned.
Text operands are also identified when they appear in subtraction, multiplication, or division expressions. This catches a common beginner mistake such as subtracting a text field from a number field:
```claro
SET player.score player.score - player.name
```
```text
Type mismatch for field player.score: expected NUMBER, but this value looks like TEXT.
```
The expression checker still deliberately reports only the type it can infer; full operator-specific rules remain future work.
`CHECK TYPE` also preserves TEXT field metadata through the same chained aliases:
```claro