Files
aji/tests/conformance/phase4/reject/island_use_after_send.air
T
dev 7cc23338e2 Phase 4 exit review; AIR twins for the .aji-only island rejects
New AIR rejects: island_use_after_send (E2001), island_lend_task (E4002),
island_destroy_while_borrowed (E2101), arc_content_mutex (E2111),
frozen_borrow_mut (E1001). Every Phase 4 invariant now has an AIR and an
.aji test. Full suite 392/392, also under --stress 1000 and
--collect-every-step; test-extended, hosted smoke, source coverage 61/61.
2026-10-05 22:22:58 +03:00

44 lines
1.2 KiB
LLVM

; After an island is sent, the sender holds nothing that reaches it: a later use is E2001.
; expect: reject E2001
; phase: 4
; spec: docs/spec/03-memory-model.md
module test.island_use_after_send
air 0
lang 0.1
features [cancellation, capabilities, channels, effects, heap, islands, ownership, resources, tasks]
fn @main(%heap: cap<mem.alloc>) -> u64
effects [mem.alloc, task.wait]
entry:
%one = const.usize 1
channel.make island<u64>, %one, %heap, ok -> @made, err -> @oom
made(%tx: sender<island<u64>>, %rx: receiver<island<u64>>):
%v = const.u64 1
island.create %v, %heap, ok -> @built, err -> @oom2
built(%i: island<u64>):
%txb = borrow.mut %tx
channel.send %txb, %i, ok -> @sent, closed -> @fail, cancelled -> @fail
sent:
borrow.end %txb
%g = borrow.ref %i
borrow.end %g
channel.close_sender %tx
%rxb = borrow.mut %rx
channel.recv %rxb, ok -> @got, closed -> @none, cancelled -> @none
got(%back: island<u64>):
borrow.end %rxb
island.destroy %back
channel.close_receiver %rx, ok -> @done, pending -> @pending
none:
trap
done:
ret %v
pending(%r: receiver<island<u64>>):
trap
fail(%x: island<u64>):
trap
oom(%e: alloc_error):
trap
oom2(%e2: alloc_error):
trap