macro/pattern: add type_is basic golden (MethodCall .is → MIR TypeOp mapping); docs: AST JSON v0 note for is/as mapping

This commit is contained in:
Selfhosting Dev
2025-09-20 01:51:55 +09:00
parent 126cf18e82
commit 9b9080d0a3
4 changed files with 53 additions and 0 deletions

View File

@ -44,6 +44,11 @@ Binary operators
Notes
- The schema is intentionally minimal; it covers nodes needed for Phase 2 samples.
- Future: add `span`, `attrs`, typed annotations as needed.
- Type checks (is/as) mapping
- AST JSON v0 does not introduce a dedicated TypeOp node. Instead, write MethodCall with
method "is" or "as" and a single string literal type argument:
{"kind":"MethodCall","object":<expr>,"method":"is","arguments":[{"kind":"Literal","value":{"type":"string","value":"Integer"}}]}
- Lowering maps this to MIR::TypeOp(Check/ Cast) with the target type resolved by name.
## Example