typecheck: align inline method field annotations

This commit is contained in:
Hermes Agent
2026-09-15 10:34:48 +00:00
parent 9b5e7f3d90
commit 0a31646f5d
8 changed files with 36 additions and 2 deletions
+1
View File
@@ -68,6 +68,7 @@ Still needed:
- type checking through branches and loops
- richer object field type checking beyond simple direct assignments
- typed imports/modules
- inline method-field annotations must agree with the class `HAS` declaration; conflicting annotations now get a repair-oriented diagnostic even when the value's inferred type is otherwise correct.
Good starting docs:
- `ADVANCED_STATIC_TYPING.md`
+1
View File
@@ -48,6 +48,7 @@ Keep declared return types honest: `claro typecheck` now reports friendly diagno
8a. Keep method-body text expressions balanced: modern TEXT field concatenation is covered when the field is on either side of `+`, so both common beginner word-order patterns remain accepted.
8b. Keep compatibility method-body text expressions aligned: `TAKES` / `LEARNED` methods now have positive TEXT concatenation coverage in both operand orders beside the modern `TEACH` / `END` examples.
8c. Keep explicit method-field annotations aligned with class declarations: `SET score TEXT "oops"` inside a method with `HAS score NUMBER` now reports the declared field mismatch instead of accepting the inline annotation; broader annotation consistency remains planned.
8d. Keep inline method-field annotations consistent with `HAS` declarations: `claro typecheck` now rejects a conflicting annotation even when the assigned value itself has the class-declared type, and explains which type to use.
### 1. Strong static types