subflow invalid branch

✓ Passing This code compiles and runs correctly.

Code

// ============================================================================
// Test 305: Subflow with Invalid Branch Reference
// ============================================================================
// Tests that the shape checker validates subflow continuations
// A subflow that references a non-existent branch should fail shape checking
// ============================================================================

const std = @import("std");

// Event with only ONE branch
~event double { value: i32 }
| doubled i32

~proc double {
    return .{ .doubled = value * 2 };
}

// Event to test
~event process { input: i32 }
| final i32

// INVALID subflow: references 'tripled' branch but double event has no such branch!
// This should fail shape checking with "Event 'double' has no branch 'tripled'"
~process = double(value: input)
| doubled d |> final { output: d.value }
| tripled t |> final { output: t.value }  // ERROR: 'tripled' doesn't exist!
input.kz

Error Verification

Expected Error Pattern

Subflow Invalid Branch Validation Test

This test MUST FAIL to verify that the shape checker validates subflow continuations.

Expected behavior:
- Subflow invokes `double` which only has a `doubled` branch
- Subflow has a continuation for `tripled` which doesn't exist
- Shape checker should reject this with "Event 'double' has no branch 'tripled'"

This validates that the shape checker properly checks subflow continuation branches.

Actual Compiler Output

error[KORU021]: event 'input:double' has no branch 'tripled' (available: doubled)
  --> structural_check:28:0

❌ Compiler coordination error: Incomplete branch coverage
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/350_SUBFLOWS/305_subflow_invalid_branch/backend.zig:9395:17: 0x1043724af in emit (backend)
                return error.CompilerCoordinationFailed;
                ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/350_SUBFLOWS/305_subflow_invalid_branch/backend.zig:9479:28: 0x1043732b7 in main (backend)
    const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
                           ^

Test Configuration

MUST_FAIL