039 branch payload requires binding

✓ Passing This code compiles and runs correctly.

Code

// Test: Branch with payload requires binding or explicit discard
//
// When a branch has a payload (e.g., `result { value: i32 }`), the branch
// handler MUST either bind it or explicitly discard with `_`:
//
//   | result r |>    // LEGAL - binds payload to 'r'
//   | result _ |>    // LEGAL - explicitly discards payload
//   | result |>      // ILLEGAL - payload exists but no binding
//
// This test verifies the compiler catches the illegal case.

const std = @import("std");

~event compute { x: i32 }
| result { value: i32 }

~proc compute {
    return .{ .result = .{ .value = x * 2 } };
}

// BUG: This should be a compile error!
// The `result` branch has payload `{ value: i32 }` but no binding.
// Correct syntax would be: `| result _ |>` or `| result r |>` (if `r` is used)
~compute(x: 42)
| result |> std.io:println(text: "done")
input.kz

Error Verification

Actual Compiler Output

[PHASE 2.4] Calling run_pass for transforms\n[PHASE 2.5] Executing comptime_main() - running comptime flows
[PHASE 2.5] Comptime flows complete (32 items)
[PHASE 2.6] Rescanning transformed AST (32 items)
[PHASE 2.6] Rescan complete: 25 comptime events found
  [0] std.compiler:requires
  [1] std.compiler:flag.declare
  [2] std.compiler:command.declare
  [3] std.compiler:coordinate
  [4] std.compiler:context_create
  [5] std.testing:test
  [6] std.testing:validate_mocks
  [7] std.testing:test.with_harness
  [8] std.testing:test.harness
  [9] std.testing:assert
  [10] std.testing:test.property.equivalent
  [11] std.deps:deps
  [12] std.deps:requires.system
  [13] std.deps:requires.zig
  [14] std.control:if
  [15] std.control:for
  [16] std.control:capture
  [17] std.control:const
  [18] std.build:requires
  [19] std.build:variants
  [20] std.build:config
  [21] std.build:command.sh
  [22] std.build:command.zig
  [23] std.build:step
  [24] std.template:define
error[KORU030]: branch 'result' has payload but no binding
  --> structural_check:25:0

❌ Compiler coordination error: Unknown event referenced
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_039_branch_payload_requires_binding/backend.zig:9348:17: 0x102f4e433 in emit (backend)
                return error.CompilerCoordinationFailed;
                ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_039_branch_payload_requires_binding/backend.zig:9432:28: 0x102f4f1bf in main (backend)
    const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
                           ^

Test Configuration

MUST_FAIL

Expected Error:

branch 'result' has payload but no binding