- air: resource types file<read|write|append>, listener, stream; io_error; intrinsic registry (19 intrinsics) synced with reference/intrinsics.md; fallible intrinsics as ok/err terminators; fs prefix narrowing; linear_aggregates gating - verifier: intrinsic form, operand, result and capability-kind checks (E1001, E3201, E5002); intrinsic effects (E3101); resource linearity in the borrow walker with per-edge moves: E3002 leaks and join mismatches, E3001, E2001, E2002, E2101 for close while borrowed; resources as borrow roots - interp: deterministic world (captured console, VFS, loopback TCP, instruction clock, pinned xoshiro256 PRNG), blocked outcome, run record with stdout/stderr/files - CLI: --stdin, --vfs, --seed, --result-file, --profile (hosted: exit 3), exit code 7; runner: stdin/vfs/seed/stdout/stderr/file/blocked headers - conformance: hello, file copy and TCP echo exit programs; 37 new tests; 4000 mutants without a crash
26 lines
621 B
LLVM
26 lines
621 B
LLVM
; The file is closed on one path into the join but still owned on the other.
|
|
; expect: reject E3002
|
|
; phase: 2
|
|
; spec: docs/spec/06-resources-and-errors.md
|
|
module test.resource_join_mismatch
|
|
air 0
|
|
lang 0.1
|
|
features [arrays, capabilities, effects, ownership, resources]
|
|
|
|
fn @f(%c: cap<fs.read>, %p: slice<u8>, %b: bool) -> void
|
|
effects [fs.read]
|
|
entry:
|
|
intrinsic fs.open_read(%c, %p), ok -> @opened, err -> @fail
|
|
opened(%f: file<read>):
|
|
cbr %b, @close(), @keep()
|
|
close:
|
|
intrinsic fs.close(%f), ok -> @join, err -> @cf
|
|
keep:
|
|
br @join()
|
|
join:
|
|
trap
|
|
cf(%e2: io_error):
|
|
trap
|
|
fail(%e: io_error):
|
|
ret
|