Phase 6A: .aji layer 2 (structs, enums, exhaustive match)

Owner rules: struct/enum declarations in Rust form; one construction
form each (named struct literal, Enum::Variant); struct fields lowered
in declaration order, so field order in the source does not change the
AIR (golden test with two orders, one AIR); match over enums exhaustive
with no '_' (E7004 lists missing variants, E7006 for '_'), integer
match needs '_'; payload names scoped to their arm (enum.switch block
parameters); match as an expression with a merge block; arm-level
source map; no destructuring, guards or nested patterns. Type inference
limits written into spec 15 (one function, monomorphic, no search,
E7007). aji lower --stats: source/AIR size and expansion ratio.

Tests: 4 run (one shared golden), 7 rejects incl. verifier-caught E1003.
This commit is contained in:
dev committed 2026-10-05 11:31:56 +03:00
1 parent ba3e9b3719
commit 0fdd04179b
22 files changed
+702 -121

No files matched your search

+1 -1
View File
@@ -39,7 +39,7 @@ Lowering layers (P6A-3/4), each with accepted (golden AIR), rejected (`E7xxx`) a
| Layer | Content | Status |
|---|---|---|
| 1 | scalars, expressions, functions, control flow, variables carried across joins, short-circuit `and`/`or`, casts | done |
| 2 | structs, enums, `match`, outcome matches, `or trap` | todo |
| 2 | structs (named construction, declaration-order lowering), enums (`Enum::Variant`), exhaustive `match` over enums (no `_`) and integers (`_` required), `match` as an expression; outcome matches and `or trap` move to layer 5 with the fallible operations | done |
| 3 | arrays, slices, byte strings | todo |
| 4 | lexical borrows, frame storage, `move`, places | todo |
| 5 | `own`, regions, resources, unsafe | todo |