019 auto discharge branch constructor

✗ Failing This test is currently failing.

Failed: backend-exec

Error Details

output_emitted.zig:19:38: error: expected type 'output_emitted.main_module.check_file_event.Output', found 'void'

Failure Output

Showing last 10 of 14 lines
output_emitted.zig:9:28: note: union declared here
        pub const Output = union(enum) {
                           ^~~~~
output_emitted.zig:12:51: note: function return type declared here
        pub fn handler(__koru_event_input: Input) Output {
                                                  ^~~~~~
referenced by:
    flow0: output_emitted.zig:29:62
    main: output_emitted.zig:120:22
    4 reference(s) hidden; use '-freference-trace=6' to see all references

Code

~import "$app/fs"
~event check_file { path: []const u8 }
| result []const u8
~check_file = app.fs:open(path: path)
| opened _ |> result "file exists"  // obligation should be auto-discharged before returning!
~check_file(path: "test.txt")
| result _ |> _
pub fn main() void {}
input.kz

Expected

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 {
    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 {
    std.debug.print("Closing file (auto-discharged)\n", .{});
}
fs.kz

Test Configuration

MUST_RUN