typecheck: accept nested complete returns

This commit is contained in:
Hermes Agent
2026-09-09 22:21:22 +00:00
parent 74998a4f11
commit 39be2a57ef
7 changed files with 38 additions and 4 deletions
+20
View File
@@ -56,6 +56,26 @@ ADD person TO people
This is accepted with `Type check OK`. More complex nested container operations and full key/value inference remain future work.
## Complete conditional returns
When a function declares a return type, `claro typecheck` accepts nested conditionals when every branch returns a value of that type:
```claro
TEACH choose flag RETURNS NUMBER
IF flag
IF flag
RETURN 1
ELSE
RETURN 2
END
ELSE
RETURN 3
END
END
```
An incomplete branch still produces a missing-return diagnostic. Deeper control-flow analysis through loops and more complex conditions remains planned.
## Object aliases and field checks
When a simple object is assigned to another variable, `claro typecheck` preserves its class for direct field assignments: