✓
Passing This code compiles and runs correctly.
Code
// PINS: a ?*T<live> parameter accepts both halves of optionality — a
// held *T<live!> token AND a null literal. The optional wrap applies to
// phantom pointer args the same as it does to scalars (?i32 accepts
// i32 and null alike). The borrow does not consume the obligation;
// drop still discharges it afterwards.
const std = @import("std");
~tor make {} -> *std.fs.File<live!>
~proc make|zig {
const allocator = std.heap.page_allocator;
const f = allocator.create(std.fs.File) catch unreachable;
return f;
}
~tor take { f: ?*std.fs.File<live> }
~proc take|zig {
_ = f;
std.debug.print("took\n", .{});
}
~tor drop { f: *std.fs.File<!live> }
~proc drop|zig {
}
~make(): f
|> take(f)
|> take(f: null)
|> drop(f)
Actual
took
took
Expected output
took
took
Flows
flow ~make click a branch to expand · @labels scroll to their anchor
make
Test Configuration
MUST_RUN