cli: lower scalar binary operands iteratively

This commit is contained in:
dev committed 2026-10-10 17:55:46 +03:00
1 parent e3f4695efe
commit 6945b511a4
5 files changed
+572 -117

No files matched your search

+61 -2
View File
@@ -214,9 +214,9 @@ per-step GC validation or measure model capability.
Fixed pre/post executables retain exact exit/stdout/stderr for all 1,423 public
source checks and 506 successful lowerings (`source-use-query-cli-compatibility.json`).
## Remaining work
## Binary operand lowering continuations
Follow-up probes after the expected-use repair accept 16 levels but abort at
The preceding follow-up probes accept 16 levels but abort at
1,024, with empty stdout, in three independent paths: a left-associated
`1i64 + … + 1i64` chain in `Lowerer.binary`; nested parentheses in the parser's
primary/postfix expression path; and a unary chain in a specialized generic
@@ -224,6 +224,65 @@ function body in `generics.expression`/`walk`. Evidence is retained as
`post-use-query-depth-probes.json` and `post-use-*.stdout/.stderr`. These are
observed native failures, not normative depth rejections.
Unary and binary scalar operands now share one continuation driver. Eager
operators retain operand-type selection, left lowering/check before right,
post-operand operator validation and exact instruction/span/name order. This
also removes native re-entry on alternating unary/binary trees. Non-operand
handlers remain outside this repair.
Boolean continuations preserve short-circuit lowering: validate left, emit
the short constant, create RHS/join blocks and the join parameter, branch,
lower/check right, branch to the stored join and resume there. Runtime still
evaluates right only when needed; both operands are lowered and type checked.
Negative zero order, signed-minimum literal handling, cast checks, atomic
diagnostics and iref identity rules remain unchanged. Host worklist OOM
propagates without a query diagnostic or public partial AIR; its metadata is
released while generated values retain their caller-arena lifetime. Allocation
counts/failure-index outcomes are not promised identical.
The independent old scalar derivation now covers binary rules as well as
unary descent. It compares 6,048 binary/wrapper/context combinations, in
addition to the existing unary cases: values/errors, blocks, parameters,
instructions/spans, counter, current block and features. Name/type/query and
non-operand handlers are shared, outside this oracle's independence. Separate
tests cover 32,768 left/right arithmetic nodes, 32,768 alternating groups,
16,384 boolean/unary groups in both orientations, and every backing-allocation
failure on numeric and boolean fixtures with exact complete block prefixes and
full cleanup. These helper tests do not assert arbitrary source acceptance.
The old 1,024-addition source now accepts, as do full arithmetic checks and
lowerings through 65,536 operations. Boolean chains accept at 1,024; at 16,384
both and/or now reach the existing E5101 block limit (spec 08 §7), with
`limit: blocks per function`, `max: 16384`, `found: 32769`, rather than aborting.
The raw source checks are retained in `binary-lowering-repaired-depth.json`
and `binary-repaired-*.stdout/.stderr`. The permanent CLI suite checks exact
instruction counts, fuel boundaries, values/profiles/source-to-AIR parity,
the block-limit refusal, and skipped/executed RHS division traps. Trap source
locations are checked separately; plain AIR has no source map.
Build/unit/Zig format checks and all 1,793 ordinary conformance cases pass
with exact unique corpus coverage (`source-binary-lowering-conformance.jsonl`
and its audit). The permanent expression-depth suite passes 360 checks.
Non-value/independent-error CLI suites pass 635/234 checks;
fixed pre/post executables retain exact exit/stdout/stderr on all 1,423 public
source checks and 506 successful lowerings
(`source-binary-lowering-cli-compatibility.json`). These do not establish full
GC validation or a model-capability result.
No normative rule, source/AIR format, feature, error code, bundle text, runtime
instruction, ownership rule or acceptance limit changes. Q-061 remains open.
## Remaining work
Current follow-up checks still abort with empty stdout at 1,024 parenthesized
levels and 1,024 generic unary levels (`binary-followup-depth-probes.json` and
`binary-followup-*.stdout/.stderr`). Parenthesized parsing and generic expression
transformation require separate repairs.
Inspection of the generic transformation also finds a recursive qualified-path
callback (`generics.path`). Its deep full-source behavior is unverified here;
it belongs in that repair's callback inventory, rather than Q-059's type scope.
Other expression/block handlers and their complete depth behavior need further
auditing. The formatter's expression-marking traversal already uses a worklist,
as inspected and exercised by the deep syntax-only probes. Q-061 and Phase 6