✓
Passing This code compiles and runs correctly.
Code
const std = @import("std");
const File = struct { handle: i32 };
~tor open { path: string } -> *File<opened!>
~proc open|zig {
std.debug.print("Opening file\n", .{});
const f = std.heap.page_allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return f;
}
~tor close { file: *File<!opened> }
~proc close|zig {
std.debug.print("Closing file (auto-discharged)\n", .{});
}
~tor get-file { path: string } -> *File<opened!>
~get-file = open(path): f -> f
~get-file(path: "test.txt")
Actual
Opening file
Closing file (auto-discharged)
Expected output
Opening file
Closing file (auto-discharged)
Flows
subflow ~get-file click a branch to expand · @labels scroll to their anchor
open (path)
flow ~get-file click a branch to expand · @labels scroll to their anchor
get-file (path: "test.txt")
Test Configuration
MUST_RUN