✓
Passing This code compiles and runs correctly.
Code
~import app/fs
~event check-file { path: []const u8 }
| result []const u8
~check-file = app/fs:open(path)
| opened _ => result "file exists" // obligation should be auto-discharged before returning!
~check-file(path: "test.txt")
| result _ |> _
Actual
Opening file: test.txt
Closing file (auto-discharged)
Expected output
Opening file: test.txt
Closing file (auto-discharged)
Imported Files
const std = @import("std");
const File = struct { handle: i32 };
~pub event open { path: []const u8 }
| opened *File<opened!>
~proc open|zig {
std.debug.print("Opening file: {s}\n", .{path});
const f = std.heap.page_allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return .{ .opened = f };
}
~pub event close { file: *File<!opened> }
~proc close|zig {
std.debug.print("Closing file (auto-discharged)\n", .{});
}
Test Configuration
MUST_RUN