tests: add nested-size source rejection twins

This commit is contained in:
dev committed 2026-10-09 18:43:18 +03:00
1 parent b3051f161c
commit a491eba193
8 files changed
+95 -1

No files matched your search

+6
View File
@@ -329,6 +329,12 @@ Validation: full conformance is 1,713/1,713; unit tests, Zig formatting, all 62
The frontend ordinary-dereference E4202 now adds concrete found and use fields, retaining the code, message, primary position and early failure. CLI tests pass 33 checks; comparison with the previous compiler passes 52, including generic/package provenance, first-error selection, untouched alternative errors and identical valid AIR. No SSA identity or AIR location is fabricated for a frontend rejection. Atomic access invariants, verifier/runtime rules and deterministic execution remain unchanged; valid reads use explicit atomic.load orderings. The schema is additive; the source bundle grows by 30 tokens (docs/agent/README.md). Q-053 remains the owner decision on the literal criterion; there are no unaudited public rows.
## P6-7 nested-size rejection twins (2026-10-09)
Five Q-058 regression cases now have verified source/AIR twins with identical E5101 budget facts: finite nested value size, one-GiB anonymous content with an unrelated named declaration, mutex wrapper/content, checked-u64 size overflow and a local frame one byte over the limit. The nominal-context pair additionally compares the complete type declarations. Existing markers, canonical/annotated lowering, raw AIR diagnostic projection and independent source coordinates are checked by the regular twin tool. Same-code coverage is 96/205; 45 E7xxx analogues and 63 AIR-only cases remain unmet.
One row remains pending: nested_size_cycle_overflow.air reports E5101 before finite-layout validation, while the same source declaration necessarily rejects earlier with E1003. A separate source fixture preserves that actual code; it is not falsely linked as an E5101 twin. The current inventory's E7xxx analogue category cannot represent this earlier verifier-code rejection. Q-053's literal completion decision remains open; no rejection rule or diagnostic is changed for coverage. Full conformance passes 1765/1765; sixteen nested-size cases also pass with collection before every instruction. All 62 checker regressions pass, and source construct coverage stays 121/121. No fresh Claude review was available for this increment. P6-7 remains doing.
## P6-1 source specification consistency (2026-10-09)
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.
+31
View File
@@ -1732,6 +1732,37 @@
"kind": "air_only",
"spec": "docs/spec/15-source-language.md \u00a74",
"rule": "The AIR regression passes a lent task as switch target arguments. Source integer/enum match arms have no target arguments; changing variables reach a subsequent br join. A later-merge E4302 would discard the switch-handoff context being tested."
},
"phase1/reject/nested_size_frame.air": {
"kind": "same_code",
"site": "function",
"spec": "docs/spec/08-verifier.md \u00a77.1",
"rule": "A one-MiB nested array and one byte both need frame storage. The source and AIR retain identical limit/max/found/type facts."
},
"phase1/reject/nested_size_gib.air": {
"kind": "same_code",
"site": "function",
"spec": "docs/spec/08-verifier.md \u00a77.1",
"rule": "An unrelated nominal type cannot truncate anonymous array accounting. The source and AIR retain identical limit/max/found/type facts.",
"match_type_declarations": true
},
"phase1/reject/nested_size_mutex.air": {
"kind": "same_code",
"site": "function",
"spec": "docs/spec/08-verifier.md \u00a77.1",
"rule": "Mutex accounting includes its content and the eight-byte wrapper. The source and AIR retain identical limit/max/found/type facts."
},
"phase1/reject/nested_size_overflow.air": {
"kind": "same_code",
"site": "function",
"spec": "docs/spec/08-verifier.md \u00a77.1",
"rule": "Anonymous nested-array arithmetic retains checked-u64 overflow. The source and AIR retain identical limit/max/found/type facts."
},
"phase1/reject/nested_size_value.air": {
"kind": "same_code",
"site": "function",
"spec": "docs/spec/08-verifier.md \u00a77.1",
"rule": "A parameter of array<array<u8,1024>,1025> accounts 1049600 bytes in both artifacts, preserving the complete value-size budget facts."
}
}
}
@@ -0,0 +1,15 @@
// A one-MiB nested array and one byte both need frame storage.
// expect: reject E5101
// phase: 6
// spec: docs/spec/08-verifier.md §7.1; docs/spec/15-source-language.md §10
// AIR twin: phase1/reject/nested_size_frame.air
module test.twins.nested_size_frame
fn unused() -> void effects [] { // diagnostic here: fn unused
var a: [[u8; 1024]; 1024] = zero;
var b: u8 = zero;
ref av = a;
ref bv = b;
}
fn main() -> void effects [] {}
@@ -0,0 +1,11 @@
// An unrelated nominal type cannot truncate anonymous array accounting.
// expect: reject E5101
// phase: 6
// spec: docs/spec/08-verifier.md §7.1; docs/spec/15-source-language.md §10
// AIR twin: phase1/reject/nested_size_gib.air
module test.twins.nested_size_gib
struct Unused { n: u8 }
fn unused(data: [[[u8; 1024]; 1024]; 1024]) -> void effects [] {} // diagnostic here: fn unused
fn main() -> void effects [] {}
@@ -0,0 +1,12 @@
// Mutex accounting includes its content and the eight-byte wrapper.
// expect: reject E5101
// phase: 6
// spec: docs/spec/08-verifier.md §7.1; docs/spec/15-source-language.md §10
// AIR twin: phase1/reject/nested_size_mutex.air
module test.twins.nested_size_mutex
fn unused(data: mutex<[u8; 1048576]>) -> mutex<[u8; 1048576]> effects [] { // diagnostic here: fn unused
return move data;
}
fn main() -> void effects [] {}
@@ -0,0 +1,10 @@
// Anonymous nested-array arithmetic retains checked-u64 overflow.
// expect: reject E5101
// phase: 6
// spec: docs/spec/08-verifier.md §7.1; docs/spec/15-source-language.md §10
// AIR twin: phase1/reject/nested_size_overflow.air
module test.twins.nested_size_overflow
fn unused(data: [[[u64; 4294967296]; 4294967296]; 1]) -> void effects [] {} // diagnostic here: fn unused
fn main() -> void effects [] {}
@@ -2,6 +2,7 @@
// expect: reject E5101
// phase: 6
// spec: docs/spec/08-verifier.md §7.1; docs/spec/15-source-language.md §10
// AIR twin: phase1/reject/nested_size_value.air
module nested_size
fn unused(data: [[u8; 1024]; 1025]) -> void effects [] {}
fn unused(data: [[u8; 1024]; 1025]) -> void effects [] {} // diagnostic here: fn unused
fn main() -> void effects [] {}
@@ -0,0 +1,8 @@
// Source declaration validation rejects the by-value cycle before AIR budgets.
// This is not a same-code twin of nested_size_cycle_overflow.air (E5101).
// expect: reject E1003
// phase: 6
// spec: docs/spec/15-source-language.md §1
module test.nested_size_cycle
struct A { n: u8, x: [A; 4294967296] }
fn main() -> void effects [] {}