tests: audit feature-header context and rejection boundaries

This commit is contained in:
dev committed 2026-10-08 22:12:04 +03:00
1 parent fe63ae9586
commit 03305f0957
13 files changed
+326 -10

No files matched your search

@@ -0,0 +1,10 @@
// expect: reject E7005
// phase: 6
// spec: docs/spec/15-source-language.md §13
module test.endian
import std.bytes;
fn main() -> u8 effects [] {
let r = std.bytes.ReadU16::ok(1u32); // diagnostic here: 1u32)
return 0;
}
@@ -0,0 +1,10 @@
// expect: reject E7006
// phase: 6
// spec: docs/spec/15-source-language.md §8
module test.fallible_without_targets
fn f(c: cap<fs.read>) -> void effects [fs.read] {
fs.open_read(c, b"/a"); // diagnostic here
}
fn main() -> void effects [] {}
@@ -0,0 +1,13 @@
// expect: reject E7005
// phase: 6
// spec: docs/spec/15-source-language.md §6
module test.intrinsic_ok_arity
fn f(c: cap<fs.read>) -> void effects [fs.read] {
match fs.open_read(c, b"/a") {
ok => {}, // diagnostic here: ok =>
err(e) => {}
}
}
fn main() -> void effects [] {}
@@ -0,0 +1,13 @@
// expect: reject E7005
// phase: 6
// spec: docs/spec/15-source-language.md §8
module test.narrow_ok_arity
fn f(c: cap<mem.alloc>, n: usize) -> void effects [] {
match cap.narrow.budget(c, n) {
ok => {}, // diagnostic here: ok =>
err(e) => {}
}
}
fn main() -> void effects [] {}
@@ -0,0 +1,11 @@
// expect: reject E0006
// phase: 6
// spec: docs/spec/04-concurrency-and-atomics.md §33.1; docs/spec/15-source-language.md §10
// AIR twin: phase3/reject/tasks_handle_as_parameter.air
module test.p
fn f(t: task<u8>) -> void effects [] { // diagnostic here
trap;
}
fn main() -> void effects [] {}
@@ -0,0 +1,14 @@
// expect: reject E3202
// phase: 6
// spec: docs/spec/05-effects-and-capabilities.md §10.4; docs/spec/15-source-language.md §8
// AIR twin: phase2/reject/unknown_narrowing_form.air
module test.unknown_narrowing_form
fn f(c: cap<io.write>, n: usize) -> void effects [] {
match cap.narrow.budget(c, n) { // diagnostic here: cap.narrow.budget
ok(d) => {},
err(e) => {}
}
}
fn main() -> void effects [] {}
@@ -5,4 +5,4 @@ module test.bounded_math
import std.math;
fn main() -> std.math.U64Result
effects []
{ return std.math.U64Result::ok(true); }
{ return std.math.U64Result::ok(true); } // diagnostic here: true)
@@ -3,4 +3,4 @@
// spec: docs/spec/16-standard-library.md §2.5–§2.7
module test.text
import std.utf8;
fn main() -> std.utf8.NextResult effects [] { return std.utf8.NextResult::ok(true, 1); }
fn main() -> std.utf8.NextResult effects [] { return std.utf8.NextResult::ok(true, 1); } // diagnostic here: true, 1