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

+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 [] {}