021 auto discharge multiple resources

✓ Passing This code compiles and runs correctly.

Code

~import "$app/fs"
const std = @import("std");
~app.fs:open(path: "first.txt")
| opened _ |>
    app.fs:open(path: "second.txt")
    | opened f2 |>
        app.fs:close(file: f2)
pub fn main() void {}
input.kz

Expected

Opening: first.txt
Opening: second.txt
Closing file
Closing file

Actual

Opening: first.txt
Opening: second.txt
Closing file
Closing file

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: {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\n", .{});
}
fs.kz

Test Configuration

MUST_RUN