typecheck: preserve text operands in arithmetic diagnostics
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user