tests: audit task argument identities and source error boundaries

This commit is contained in:
dev committed 2026-10-08 20:57:51 +03:00
1 parent fd92604f36
commit 2742867ef7
18 files changed
+344 -20

No files matched your search

@@ -0,0 +1,7 @@
// A struct containing capability authority cannot be zero initialized, using zero_not_zeroable.
// expect: reject E7006
// phase: 6
// spec: docs/spec/15-source-language.md §4/§10
module test.source_analogue_capability_not_zeroable
struct H { c: cap<fs.read> }
fn main() -> u64 effects [] { var h: H = zero; return 0u64; } // diagnostic here: var h
@@ -0,0 +1,8 @@
// A duplicate function declaration rejects before AIR with the duplicate_declaration reason registered by spec 15 §10 in reference/error-codes.md.
// expect: reject E7006
// phase: 6
// spec: docs/spec/15-source-language.md §10
module test.source_analogue_duplicate_function
fn f() -> void effects [] {}
fn f() -> void effects [] {} // diagnostic here
fn main() -> u64 effects [] { return 0u64; }
@@ -0,0 +1,6 @@
// The integer literal 256 cannot fit u8; source checks its typed range before AIR under the general source-decided type rule.
// expect: reject E7005
// phase: 6
// spec: docs/spec/15-source-language.md §10
module test.source_analogue_literal_out_of_range
fn main() -> u64 effects [] { let x: u8 = 256; return 0u64; } // diagnostic here: 256
@@ -0,0 +1,7 @@
// u64 cannot be returned from a u32 function; this type-decided error is E7005.
// expect: reject E7005
// phase: 6
// spec: docs/spec/15-source-language.md §10
module test.source_analogue_return_type_mismatch
fn f() -> u32 effects [] { return 1u64; } // diagnostic here: 1u64
fn main() -> u64 effects [] { return 0u64; }
@@ -0,0 +1,7 @@
// zero initialization requires a zeroable type; an enum rejects with registered zero_not_zeroable.
// expect: reject E7006
// phase: 6
// spec: docs/spec/15-source-language.md §4/§10
module test.source_analogue_zero_enum
enum E { A, B }
fn main() -> u64 effects [] { var e: E = zero; return 0u64; } // diagnostic here: var e
@@ -0,0 +1,20 @@
// An exclusive view of a task handle is not Send.
// expect: reject E4001
// phase: 6
// spec: docs/spec/04-concurrency-and-atomics.md §35
// AIR twin: phase3/reject/tasks_not_send.air
module test.source_task_non_send
fn noop() -> u8 effects [] { return 0u8; }
fn hold(handle: mut<task<u8>>) -> void effects [] {}
fn main() -> void effects [task.spawn] {
scope sc {
let first = task.spawn(sc, noop);
{
mut lent = first;
let second = task.spawn(sc, hold, lent); // diagnostic here: task.spawn
task.join(move second);
}
task.join(move first);
}
}