037 default discharge must be void

✓ Passing This code compiles and runs correctly.

Code

// TEST: [!] annotation on multi-branch event is a compile error
//
// MUST_FAIL
//
// The [!] annotation marks an event as the default auto-discharge target.
// But events with multiple branches CANNOT be auto-discharged
// (because multiple branches require manual handling).
//
// Marking a multi-branch event with [!] is contradictory and should error.
//
// Expected: Compile error about [!] requiring single-outcome event

// Resource with obligation
pub const Handle = struct {
    id: i32,
};

// Event that creates obligation
~event open {}
| ok *Handle[open!]

~proc open {
    const h = std.heap.page_allocator.create(Handle) catch unreachable;
    h.* = .{ .id = 42 };
    return .{ .ok = h };
}

// ERROR: [!] on event with branches is invalid
// Branched events require manual handling, cannot be auto-discharged
~[!]event close { h: *Handle[!open] }
| closed
| error []const u8

~proc close {
    std.heap.page_allocator.destroy(h);
    return .{ .closed = .{} };
}

const std = @import("std");
input.kz

Error Verification

Actual Compiler Output

error[KORU083]: [!] annotation requires single-outcome event - events with multiple branches require manual handling
  --> auto_discharge:34:0

error[KORU083]: [!] annotation requires single-outcome event - events with multiple branches require manual handling
  --> auto_discharge:34: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_037_default_discharge_must_be_void/backend.zig:9359:17: 0x1022824af in emit (backend)
                return error.CompilerCoordinationFailed;
                ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/330_PHANTOM_TYPES/330_037_default_discharge_must_be_void/backend.zig:9443:28: 0x1022832b7 in main (backend)
    const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
                           ^

Test Configuration

MUST_FAIL

Expected Behavior:

MUST_FAIL # Should error because [!] is applied to an event with multiple branches CONTAINS KORU083 CONTAINS single-outcome