028 ambiguous without default

✓ Passing This code compiles and runs correctly.

Code

// TEST: Multiple disposal options without [!] should error
//
// When multiple events can discharge an obligation and NONE have [!],
// the compiler must error - it can't guess which one to use.

~import "$std/io"

const std = @import("std");

const File = struct { handle: i32 };

~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 };
}

// Two discharge options - NEITHER has [!] = ambiguous!
~event close { file: *File[!opened] }

~proc close {
    std.heap.page_allocator.destroy(file);
}

~event flush_close { file: *File[!opened] }

~proc flush_close {
    std.heap.page_allocator.destroy(file);
}

// This should FAIL - auto-discharge can't choose
~open(path: "test.txt")
| opened _ |> _
input.kz

Error Verification

Actual Compiler Output

error[KORU030]: Resource '__type_ref' [opened!] has multiple disposal options: close, flush_close. Discharge explicitly.
  --> auto_discharge:36: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_028_ambiguous_without_default/backend.zig:10798:17: 0x10291e4af in emit (backend)
                return error.CompilerCoordinationFailed;
                ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_028_ambiguous_without_default/backend.zig:10882:28: 0x10291f2b7 in main (backend)
    const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
                           ^

Test Configuration

MUST_FAIL