011 auto discharge multiple

✓ Passing This code compiles and runs correctly.

Code

~import "$app/fs"
~app.fs:open(path: "test.txt")
| opened _ |> _
pub fn main() void {}
input.kz

Error Verification

Expected Error Pattern

Backend should fail - no disposal event available or multiple disposal options

Actual Compiler Output

error[KORU030]: Resource '_auto_0' [opened!] has multiple disposal options: close, abandon. Discharge explicitly.
  --> auto_discharge:3:0

❌ Compiler coordination error: Auto-discharge failed (multiple disposal options or no disposal event)
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_011_auto_discharge_multiple/backend.zig:9406:17: 0x1042f64af in emit (backend)
                return error.CompilerCoordinationFailed;
                ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_011_auto_discharge_multiple/backend.zig:9490:28: 0x1042f72b7 in main (backend)
    const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
                           ^

Imported Files

// Library module: fs
// Multiple disposal events - requires explicit choice

const std = @import("std");

const File = struct { handle: i32 };

// Open a file - returns opened! state (requires cleanup)
~pub event open { path: []const u8 }
| opened *File[opened!]

~proc open {
    const f = std.heap.page_allocator.create(File) catch unreachable;
    f.* = File{ .handle = 42 };
    return .{ .opened = f };
}

// Close - saves any changes before closing
~pub event close { file: *File[!opened] }

~proc close {
    std.debug.print("Closing file (saving changes)\n", .{});
}

// Abandon - discards any changes
~pub event abandon { file: *File[!opened] }

~proc abandon {
    std.debug.print("Abandoning file (discarding changes)\n", .{});
}
fs.kz

Test Configuration

MUST_FAIL

Expected Error:

Multiple disposal options