✓
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("opened: {s}\n", .{path});
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("closed\n", .{});
std.heap.page_allocator.destroy(file);
}
~tor get-resource { path: string } -> *File<opened!>
~get-resource = open(path): f -> f
~get-resource(path: "test.txt"): r |> close(file: r)
Actual
opened: test.txt
closed
Expected output
opened: test.txt
closed
Flows
subflow ~get-resource click a branch to expand · @labels scroll to their anchor
open (path)
flow ~get-resource click a branch to expand · @labels scroll to their anchor
get-resource (path: "test.txt")
Test Configuration
MUST_RUN