air: compare and print nested types without recursion

This commit is contained in:
dev committed 2026-10-09 20:09:00 +03:00
1 parent d0fcc3d473
commit 53030efcea
7 files changed
+180 -67

No files matched your search

+10
View File
@@ -70,3 +70,13 @@ Unit tests cover 32,768 anonymous arrays ending in plain data, task-local state
The original complete check now accepts depths 4,096, 16,384 and 32,768 on the ordinary 8-MiB stack, with no diagnostic output. A separate 16,384-depth return-equality check accepts, and an invalid atomic content type at the same depth returns E1001 with the complete found type rather than aborting. These observations do not prove arbitrary-depth equality/formatting or uncached nominal traversal. Q-059 remains open; no semantic feature, public diagnostic code, bundle growth or new acceptance limit is introduced.
Further probes confirm the remaining sites rather than merely inferring them from source: return equality accepts depth 32,768 but aborts at 65,536 with 10,001 Type.eql frames; invalid atomic content aborts at depth 32,768 with 9,999 printType frames. Both failing checks exit -6 without diagnostic JSON. Core capture is disabled only for the child; no timeout ends a probe. Equality and diagnostic/canonical type printing now have independently verified native-stack failures.
## Type equality and printing repair
Type.eql now compares anonymous chains iteratively without allocation. Tags still differ before descent; every array length is checked before its element, and named types compare declaration indices without expanding the nominal graph. All constructor and leaf identities are unchanged.
Type printing now records anonymous suffixes in an explicit stack, then emits them from the innermost outward. Array suffixes retain their original lengths and canonical comma/space spelling; other wrappers close with >. Named declarations remain names. The internal Zig print/printType API receives a compiler allocator explicitly, with updated verifier/serializer callers; allocation and writer errors propagate. Stack storage is proportional to input nesting, deallocated after the print attempt, and adds no heap allocation to an Aji program. AIR text, diagnostic fields/codes and JSON serialization rules do not change.
Unit tests compare separate 65,536-level chains with equal types, unequal deep leaves and unequal middle array lengths; they retain each unary constructor identity. A 65,536-level varied-length type prints exactly and passes parse/print/parse/print canonical equality. Wrapper spellings, suffix-allocation failure and buffered writer failure are checked independently. Unit/format checks, test-extended and all 1,769 conformance cases pass, and all 366 public AIR checks retain exact old/new exit status, stdout and stderr.
Both verified crashing CLI inputs now finish: return equality at depth 65,536 accepts with no output, and invalid atomic content at depth 32,768 returns exactly one E1001 at the original primary position with the complete canonical found type. These are direct process outcomes on the ordinary native stack, not just isolated helper tests. Uncached nominal fallback and other type-query call paths still require audit; Q-059 remains open. No new syntax-depth limit, semantic feature, public diagnostic code or bundle text is introduced.
+2
View File
@@ -466,3 +466,5 @@ The [size-query increment](air-type-depth-audit.md#size-query-repair) removes re
The [type-validity increment](air-type-depth-audit.md#type-validity-and-finite-layout-repair) iterates anonymous position/length checks and finite-layout DFS, preserving graph stops, wrapper gates and ordered cycle diagnostics. Deep unit cases cover 32,768 anonymous and nominal levels. Complete checking at 16,384 now passes wellFormed and aborts in Module.isLinearType; property, equality, formatting and uncached nominal queries remain open. No new depth limit or normative rule is introduced.
The [anonymous property-query increment](air-type-depth-audit.md#anonymous-property-query-repair) removes recursive anonymous linearity/property/dependency walks, preserving Send/Share mode changes, nominal fixed points and the existing saturated height/witness summaries. Complete checking now accepts 32,768 nested arrays. Follow-up checks verify separate remaining failures: Type.eql at depth 65,536 and diagnostic printType at depth 32,768, both without diagnostic JSON. Equality/printing and uncached nominal fallback remain open; Q-059 is not resolved.
The [equality/printing increment](air-type-depth-audit.md#type-equality-and-printing-repair) removes anonymous recursion from Type.eql and diagnostic/canonical printing. The formerly failing 65,536-depth equality check now accepts; the 32,768-depth invalid-atomic check returns one E1001 with the complete found type. The serializer uses an explicit compiler allocator for its suffix stack, retaining AIR spelling and diagnostic fields. Uncached nominal fallback and remaining type-query call paths still need audit; Q-059 remains open.
+2
View File
@@ -347,6 +347,8 @@ The [Q-059 type-validity increment](../design/air-type-depth-audit.md#type-valid
The [Q-059 anonymous property-query increment](../design/air-type-depth-audit.md#anonymous-property-query-repair) iterates linearity, structural predicates and dependency discovery, with explicit Send/Share transitions and unchanged saturated height/witness summaries. Unit cases cover 32,768 anonymous levels and phantom dependencies, 65,536 alternating ref/mutex edges, and saturation boundaries. Unit/format checks, test-extended, all 1,769 conformance cases and exact old/new comparisons on 366 public AIR files pass. Complete checking accepts 32,768 nested arrays; separate probes now verify failures in Type.eql at 65,536 and diagnostic printType at 32,768. Q-059 and Phase 6 remain open. No normative/bundle/feature/code change or new syntax-depth limit; no fresh Claude review was available.
The [Q-059 equality/printing increment](../design/air-type-depth-audit.md#type-equality-and-printing-repair) iterates structural type comparison and emits canonical suffixes through an explicitly allocated compiler stack. Constructor/leaf identities, array lengths, AIR spelling and diagnostic payloads remain unchanged. Deep unit cases cover equality/inequality and varied-length canonical round trips at 65,536 levels, plus allocation/writer errors. Unit/format checks, test-extended, all 1,769 conformance cases and exact old/new output comparisons on 366 public AIR files pass. The previous CLI failures now finish: equality at 65,536 accepts; invalid atomic content at 32,768 returns one E1001 with its complete found type. Q-059 remains open for uncached nominal/query call-path audits, with no normative/bundle/feature/code change or new depth limit. No fresh Claude review was available.
Spec 15's initial Phase 6A limits now point to its existing extensions. Its introductory diagnostic rule follows §10 and construct-specific codes; widening reports source E7005 while AIR retains E1002, including the corrected Quick Reference entry. Multi-result bindings include complete unpacking, byte escapes agree with the later exact list, and grammar comments locate graph access in §8. Old incremental limits link buffers/borrow returns to §17/§19. No grammar production, semantic rule or implementation changes. Six existing public fixtures confirm the reported code and deterministic successful AIR; Claude independently audited the corrections. The reference bundle rebuilds; source growth is +50/+47/+58 tokens across the three tokenizers, with unchanged Quick Reference token counts, AIR and std (docs/agent/README.md). P6-1/P6-5 remain open for their unimplemented surfaces.
## P6-6 contract spec gate (2026-10-09)