cli: query expression types and callee paths iteratively

This commit is contained in:
dev committed 2026-10-10 17:21:30 +03:00
1 parent dd73b84085
commit e862e03f2b
5 files changed
+531 -102

No files matched your search

+4
View File
@@ -525,4 +525,8 @@ Follow-up [expression-depth probes](source-expression-depth-audit.md) now confir
The [unary lowering/addressability increment](source-expression-depth-audit.md#unary-lowering-and-addressability-continuations) removes direct not/neg/deref/cast descent and the separately confirmed recursive storage-marking prepass. Typed scalar checks/lowerings pass through 65,536 nodes; direct malformed dereferences return their inner E7005. Instruction order, signed-boundary literals, storage policy, diagnostics and host OOM propagation are retained. Q-061 remains open: a separate 16,384-dereference operand beneath a cast still aborts in `peekType` without stdout JSON, confirming the next query path; other expression/statement and generic paths remain to be audited. No normative depth limit is inferred from these repairs or tests.
The [expression-query increment](source-expression-depth-audit.md#expression-type-query-continuations) repairs that cast/dereference failure and the recursive callee path callbacks. Query continuations retain existing classification and fallback order; host metadata OOM follows the best-effort unknown-result contract. Deep cast/dereference checks now return the expected inner E7005, and deep unknown callees return E7002. This does not close `useIn`, other expression/statement lowering, nested primary parsing or generic expression transformation; no whole-frontend bound or new acceptance rule is claimed.
A subsequent finite source probe, `let n = 1; return - … n;` in an i64 function, accepts 1,024 negations but aborts without stdout JSON at 16,384 in `useIn`, during expected-use inference for the unsuffixed binding. Its raw evidence is in the linked audit. Q-061 remains open for that confirmed path and the other unverified paths above.
Audit these paths separately with finite public/generated source inputs before claiming whole-frontend bounded native-stack processing. Prefer explicit continuations preserving existing syntax, evaluation/query order, diagnostics and OOM behavior. A new depth rejection requires a normative decision; Q-059's type-traversal resolution does not authorize one.
+56 -7
View File
@@ -119,18 +119,67 @@ checks, 33 atomic-access checks, 312 grammar checks and the existing 6,078
formatter checks. All 1,423 public source checks and 506 successful lowerings
retain byte-identical old/new results with fixed baseline/current executables.
## Expression type-query continuations
On `dd73b84`, `( * … 1i64 ) as i64` at 16,384 dereferences aborts in
`peekType`, before the expected ordinary type error. Its stdout is empty and
stderr repeats dereference-query frames. The retained baseline evidence is
`unary-cast-deref-query-16384.json/.stdout/.stderr`; the repaired check returns
one E7005 at line 2, column 32,805 without stderr
(`expression-query-repaired-cli.json`).
Expression and built-in result queries now share an explicit continuation
worklist. It preserves left-before-right fallback, first-known match arm,
first array element, branch-tail policy, field/len classification, callee
priority and built-in argument/borrow handling. Negation, shift, block and
if-tail queries use loop transitions. Queries remain best-effort: type-output
OOM already returned unknown, and continuation-allocation OOM now does too,
without a diagnostic. This adds host metadata requests; allocation counts and
failure-index classifications are not claimed identical. Pending storage is
released, and type nodes keep their caller-arena lifetime.
The query's callee callbacks also exposed recursive `expressionPath` and
bounded `dotted`. Both now walk field chains iteratively. `expressionPath`
allocates one complete string rather than every ancestor prefix; direct names
and invalid roots allocate nothing. Successful path bytes, the existing
64-byte built-in lookup buffer and null-result policy are retained. Partial
buffer contents on null are private and need not match the old implementation.
An independent copy of the old expression/built-in descent compares 703
shallow combinations. Name/signature/type lookup and callee path helpers are
shared, so this oracle does not independently validate those helpers. Separate
tests cover 32,768 structural/built-in expression levels, 16,384 fallback
levels, 65,536 callee fields and allocation-error cleanup without diagnostics
or emitted instructions. The permanent CLI suite adds cast/dereference and
deep unknown-callee rejection across check/lower/run/report/explore. These
helper fixtures do not establish arbitrary deep source acceptance.
Final build/units/Zig format checks and all 1,793 ordinary conformance cases
pass with exact unique corpus coverage (`source-expression-query-conformance.jsonl`
and its audit). The expression-depth/non-value/atomic-access suites pass
139/635/33 checks; formatter integration passes 6,078 checks. Fixed old/new
executables retain exact exit/stdout/stderr on all 1,423 public source checks
and 506 successful lowerings. These are compiler regressions, not completed
per-step GC validation or a model-capability measurement.
No normative rule, source/AIR format, feature, error code, bundle text,
ownership/runtime behavior or acceptance limit changes. Q-061's other paths
remain open; this increment has no fresh Claude review.
## Remaining work
A follow-up check of `( * … 1i64 ) as i64` at 16,384 dereferences confirms a
native-stack abort in `peekType`, before the expected ordinary type error;
its stdout is empty and stderr repeats the dereference-query frames. Evidence:
`unary-cast-deref-query-16384.json/.stdout/.stderr`. General query continuation
work is still needed, beyond the negation-spine shortcut above.
After the query repair, `let n = 1; return - … n;` in an i64 function accepts
16 and 1,024 negations, but at 16,384 aborts in `useIn` while inferring the
unsuffixed binding's type. The failing check returns -6 with empty stdout and
repeated `useIn` frames. Evidence is retained as `inferred-use-depth-before.json`
and `inferred-use-neg-16384.stdout/.stderr`. This confirms the next expected-use
query failure independently of the repaired `peekType` path.
Other expression and statement paths, including parenthesized/nested primary
parsing, `useIn`, generic `expression`/`walk` and lowering's other recursive
expression/block handlers, need separate probes and repairs. Their complete
depth behavior is unverified here. The formatter's expression-marking traversal
expression/block handlers, need separate probes and repairs. Beyond the `useIn`
case above, their complete depth behavior is unverified here. 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 remain open; Q-060's unfinished full GC validation is
independent. No fresh Claude review covers these expression increments.
+6
View File
@@ -532,3 +532,9 @@ Build/units/format checks, all 1,793 ordinary conformance cases with exact cover
[Q-061 unary operand lowering](../design/source-expression-depth-audit.md#unary-lowering-and-addressability-continuations) now uses explicit continuations for not/neg/deref/cast, preserving pre-operand negative zeros, the signed-minimum literal rule, operand/target checks, atomic-load diagnostics and instruction/span order. A separate confirmed storage-marking failure is repaired by a block/statement/expression/root worklist retaining the existing traversal order and storage policy. Generated full scalar checks/lowerings pass through 65,536 nodes; deep invalid direct dereferences retain inner E7005. Both worklists propagate host OOM without diagnostics or public partial AIR. No verifier/runtime/ownership/format/bundle/feature/code/acceptance-limit change.
Independent unary/addressability oracles, 32,768-node cases and allocation cleanup tests pass. Final build/units/format checks and all 1,793 ordinary conformance cases with exact coverage pass, as do 114 expression-depth, 635 non-value, 33 atomic-access, 312 grammar and 6,078 formatter CLI checks. Old/new public checks/lowerings (1,423/506) and 47 deterministic/hosted fuel/value records are exact. A new full check independently confirms the remaining 16,384-dereference query failure beneath a cast in peekType. Q-061's general queries, other expression/statement and generic paths remain open, as do Q-060's full per-step validation and Phase 6 exit review. No fresh Claude review covers this increment.
## Source expression type queries (2026-10-10)
The [Q-061 query increment](../design/source-expression-depth-audit.md#expression-type-query-continuations) replaces expression/built-in result recursion with explicit continuations, retaining classification, lazy fallback and callee priority. Its callee callbacks build qualified paths iteratively with one complete string. Best-effort queries retain unknown on output OOM and now use the same outcome on continuation OOM; host allocation counts need not match. No normative/bundle/feature/code/acceptance-limit or runtime/ownership change.
Independent shallow descent comparisons (703), deep structural/built-in/fallback cases, 65,536-field path construction and allocation cleanup tests pass. Final build/units/format checks and all 1,793 ordinary conformance cases with exact coverage pass, as do 139 expression-depth, 635 non-value, 33 atomic-access and 6,078 formatter CLI checks; old/new public checks/lowerings remain exact (1,423/506). The formerly crashing cast/dereference source now returns its inner E7005. A separate unsuffixed-binding probe accepts 1,024 negations but confirms the next native failure in useIn at 16,384. Q-061's expected-use, other expression/statement and generic paths, Q-060's full per-step validation and Phase 6 exit review remain open. Claude's earlier Q-059 property review does not cover this increment.