frontend: align source grammar and reject empty enum payload lists

This commit is contained in:
dev committed 2026-10-08 14:14:45 +03:00
1 parent 48b9b42fed
commit 4c9c5626c9
44 files changed
+501 -33

No files matched your search

+7 -1
View File
@@ -129,7 +129,7 @@ Lowering layers (P6A-3/4), each with accepted (golden AIR), rejected (`E7xxx`) a
| ID | Status | Task | Depends | Output | Done when |
|---|---|---|---|---|---|
| P6-1 | todo | Complete the source grammar: expressions, `match`, `borrow` blocks, `task.scope`, `select`, `defer`, `?`, generics, lifetimes, contracts, attributes | — (may start after P2) | `reference/grammar.ebnf`, spec 01 | every construct in `examples/` is covered; grammar is LL(k) or otherwise documented as unambiguous |
| P6-1 | doing | Complete the source grammar: expressions, `match`, `borrow` blocks, `task.scope`, `select`, `defer`, `?`, generics, lifetimes, contracts, attributes | — (may start after P2) | `reference/grammar.ebnf`, spec 01 | every construct in `examples/` is covered; grammar is LL(k) or otherwise documented as unambiguous |
| P6-2 | doing | Lexer and parser with spans | P6-1 | `src/frontend/{lex,parse}.zig` | all `examples/` parse; syntax errors are registered diagnostics |
| P6-3 | done (RFC 0021 Implemented) | Explicit package modules, direct imports and qualified nominal types | P6-2 | `src/frontend/modules.zig`, spec 15 §14 | deterministic graph/name resolution; source/AIR and CLI tests |
| P6-4 | done (RFC 0022 Implemented) | Type checking and monomorphized generics with structural constraints (`Copy`, `Send`, `Share`, `Freeze`, `Local`) | P6-3 | `src/frontend/generics.zig`, spec 15 §15 | generic code instantiates deterministically; constraint violations diagnosed |
@@ -291,3 +291,9 @@ Validation: full conformance passes 1,543/1,543; units and Zig formatting pass.
Q-044 replaces repeated nominal walks with a shared property table and memoizes the earlier AIR accounted-size query by index/depth. The invariant is exact structural classification: existing tag rules, graph/iref boundaries, ownership classes, diagnostic ordering and depth guards remain. The verifier rebuilds caches rather than trusting callers; lowering classifies only after finite-layout checks. No verifier rule, AIR meaning, diagnostic/code/reason, source syntax, feature, interpreter state, allocation/cleanup behavior or bundle text changes. Nominal size states have the documented polynomial bound V × (V + 2), preserving the former depth-dependent calculation. Valid deep diamonds/phantom nodes and rejected cycles, oversized values, annotations and constraints have source/AIR fixtures; runtime allocation uses the checked cache.
Validation: units and Zig formatting pass; full conformance is 1,560/1,560, with all 17 new fixtures also passing collection before every instruction. Counted tests cover shared/cyclic queries, witness visits and layout rejection before classification; 256 small mixed graphs compare cached predicates, witnesses, depth guards and sizes against uncached derivations. CLI integration passes 110 checks, including source/AIR/hosted execution, actual allocation accounting, imported types and diagnostics. Existing generic/content/store-mode suites pass 32/302/348 checks. Old/new comparison changes zero outputs on 1,257 public sources (686 old lowerings) and 333 public AIR checks. Coverage remains 121/121. Claude independently ran units and approved review. P6-2 remains open; Q-049 is a separate owner-policy question.
## P6-1/P6-2 grammar surface increment (2026-10-08)
DD-022 synchronizes the grammar/spec 15 with implemented wrappers, binary literals, negative patterns, parenthesized places, declared borrow-return calls and list/arm delimiters. Ordered statement, header-brace and typed-built-in choices are documented; no LL(k) claim is made. Q-050 rejects empty qualified enum payload lists with E7001 at `(`, including generic/grouped/built-in variants and patterns. Ordinary `f()`, bare variants, non-empty payloads and outcome bindings retain their rules. No AIR, verifier/runtime, ownership/concurrency, feature or diagnostic-code changes.
Validation: units and Zig formatting pass; full conformance is 1,594/1,594, and all 34 new fixtures pass collection before every instruction, including select schedules. CLI integration passes 288 checks for syntax locations, packages, formatting and source/AIR execution. Old/new comparison changes zero check/lower outputs on 1,269 public sources (695 old lowerings); source coverage remains 121/121. The public formatter corpus passes 5,435 checks on 1,303 files, preserving 709 lowered outputs. Claude independently reviewed the change and reran units and CLI checks. Bundle growth is recorded in docs/agent/README.md. P6-1/P6-2 remain open; future syntax still needs its RFCs, and Q-051 is a separate ordinary-effect validation task.