✓
Passing This code compiles and runs correctly.
Code
const std = @import("std");
const File = struct { handle: i32 };
~event open { path: []const u8 }
| opened *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 .{ .opened = f };
}
~event close { file: *File<!opened> }
~proc close|zig {
std.debug.print("Closing file (auto-discharged)\n", .{});
}
~event get-file { path: []const u8 }
| got-file *File<opened!>
~get-file = open(path)
| opened f => got-file f
~get-file(path: "test.txt")
| got-file _ |> _
Actual
Opening file
Closing file (auto-discharged)
Expected output
Opening file
Closing file (auto-discharged)
Test Configuration
MUST_RUN