cli: lower array initializers iteratively

This commit is contained in:
dev committed 2026-10-11 11:29:24 +03:00
1 parent 6d2c4d40a8
commit 8c34a4d64d
5 files changed
+440 -29

No files matched your search

+60 -2
View File
@@ -599,6 +599,63 @@ The follow-up's unverified CLI E5101 byte-parity assumption is covered by the
302-check run. Deep boolean/field interactions beyond the shallow oracle,
borrow-place depth and full Q-061 completion are not established.
## Array list and repetition continuations
Array initializers now share the scalar/call/struct/value-field driver. Lists
retain the 1..64 size check before children, contextual or first-element
inference, left-to-right explicit consumption, and element-position checks
before exact-type checks. Their result uses actual element type and length.
Repetitions retain the 1..2^32 bound before the operand, non-consuming operand
evaluation, then member/Copy checks and `array.splat` (spec 15 §5, §16).
Queries, CFG, names, spans, loans and host OOM policy are unchanged. Stable list
states and worklist buffers have caller-arena lifetime, including on errors;
public backing-failure tests observe arena destruction, not list-deinit frees.
No normative/format/feature/code/bundle, ownership/runtime or limit change.
The copied former array descent joins the independent shallow scalar/call/
struct/field oracle. It passes 1,036 comparisons including inference, consuming
names, borrow-before-Copy, position-before-type priority, void/never, boolean
CFG and synthetic list-size boundaries. Property/emission/place helpers and
non-operand fallback leaves remain shared. Separate 32,768-level tests cover
list/repetition/call alternation with bounded types, an inferred outer list
resuming at an unsuffixed or erroring sibling, exact emission/spans, and innermost
errors.
Recovering allocation sweeps include 64 inputs and an outer repetition;
persistent public failures check arena cleanup and no partial AIR/diagnostic.
The final error-sibling test passes after entry-by-entry prefix comparison:
a fixed-size-array deep comparison initially overflowed the test helper's native
stack (`array-continuations-unit-siblings.log`, final terminal exit 0).
Build/unit/format checks and all 1,793 ordinary conformance cases pass with
exact coverage (`array-continuations-conformance.jsonl` and its audit).
Array-literal/argument/linear/nonvalue/inferred-content/independent-error CLI
suites pass 152/85/49/635/302/234 checks. Nine before/after assert/block/if
probes remain byte-identical through 256 (`array-continuations-callback-parity.json`).
The former pure-list abort at 4,096 now accepts
(`array-continuations-initial-probe.json`). Pure nested types produce quadratic
AIR text; this does not claim arbitrary-sized successful aggregate output.
The focused CLI suite passes 246 checks (`array-continuations-focused-depth.log`):
list/repetition calls accept through 65,536, mixed scalar/struct/array calls
through 32,768; at 65,536 mixed levels the existing E5101 instruction limit
reports `max: 262144`, `found: 458754`. Both pure forms check at 4,096; bounded
runs check exact values/fuel and AIR parity, formatting remains a fixed point,
and deep unknown/bound errors retain exact CLI records. Frozen public source
checks/lowerings are byte-identical (1,423/506;
`array-continuations-public-parity.json`). These are straight-line shapes;
loop/liveness/assignment callers are not thereby validated.
Claude's read-only core review found no production defect, but identified two
fixture gaps: an unbound borrow name and missing position-before-type cases.
Both were corrected, with additional sibling/inference and OOM coverage.
The read-only follow-up found no concrete defects and confirmed the CLI counts,
fuel and run-record shape (`/tmp/aji-array-continuations-review.md` and
`/tmp/aji-array-continuations-followup-review.md`). Neither reviewer ran tests;
the final test-only error-sibling addition follows that review. Separate
variant-payload/call probes accept 16 levels but abort in `prepareCall` →
`variantValue` → `consuming` at 256 in both binaries (`array-followup-variant-probes.json`).
Variant/place/builtin/control callbacks and liveness/read/assignment scans keep
Q-061 open; Q-060 full GC validation and Phase 6 gates remain separate.
## Remaining work
Follow-up checks accept 16 parenthesized/mixed-call levels but abort
@@ -613,7 +670,7 @@ includes a confirmed lowerer failure and inspection-only risks:
| Production path | Evidence and next scope |
|---|---|
| Parser `ifExpr`, block/statement and match/arm expression entry | Native callback re-entry remains. Bounded block/if regression probes above pass; arbitrary and alternating control/statement depth is unverified. |
| Lowerer non-scalar `expr` callbacks: builtin/variant calls, fields/indices/places, arrays/structs, if/match/arms and blocks/statements | Ordinary calls and struct/value-field descent are repaired above. Nested array-literal lowering still aborts at 4,096 in both binaries. Other callback depth remains unverified; include alternating scalar/non-scalar expressions. |
| Lowerer non-scalar `expr` callbacks: builtin/variant calls, fields/indices/places, arrays/structs, if/match/arms and blocks/statements | Ordinary calls, struct/value-field and array descent are repaired above. Variant-payload/call alternation still aborts at 256 in both binaries. Other callback depth remains unverified; include alternating scalar/non-scalar expressions. |
| Lowerer use-after-region/liveness and assignment scans (`After`, first-use/read scans, `blockAssigns`/`stmtAssigns`/`exprAssigns`, match/select helpers) | Recursive AST walks inspected; audit their callers and finite deep inputs separately. |
The formatter's expression-marking traversal already uses a worklist, as
@@ -622,4 +679,5 @@ claim every listed callback fails, or that all other paths have been cleared.
Q-061 and Phase 6 remain open; Q-060's unfinished full GC validation is
independent. The five reviewed increments now have a scoped external review;
the host-OOM follow-up and intermediate repairs have no separate review.
The struct/value-field increment has the scoped reviews recorded above.
The struct/value-field and array increments have the scoped reviews recorded
above.