✓
Passing This code compiles and runs correctly.
Code
~import "$std/io"
const std = @import("std");
const File = struct { handle: i32, dirty: bool };
~event open { path: []const u8 }
| opened *File[opened!]
~proc open {
const f = std.heap.page_allocator.create(File) catch unreachable;
f.* = File{ .handle = 42, .dirty = false };
return .{ .opened = f };
}
~[!]event close { file: *File[!opened] }
~proc close {
std.debug.print("closed\n", .{});
std.heap.page_allocator.destroy(file);
}
~event flush_close { file: *File[!opened] }
~proc flush_close {
std.debug.print("flushing...\n", .{});
std.heap.page_allocator.destroy(file);
}
~open(path: "test.txt")
| opened _ |> _
Expected
closed
Actual
closed
Test Configuration
MUST_RUN