004 shape error

✓ Passing This code compiles and runs correctly.

Code

// Test 355_004: Optional Branches - Shape Validation Still Applies
//
// Verifies:
// 1. Optional branches are still subject to shape checking
// 2. "Optional" means "can be omitted", NOT "can be misused"
// 3. Handling a nonexistent branch name = compile error

~import "$std/io"

// Event with required + optional branch
~event process { value: u32 }
| success u32        // REQUIRED
| ?warning []const u8   // OPTIONAL

~proc process {
    if (value > 100) {
        return .{ .warning = "Value too large" };
    }
    return .{ .success = value * 2 };
}

// Handler references a branch that doesn't exist on this event
// "nonexistent" is not a branch of process — should fail compilation
~process(value: 150)
| success _ |> std.io:print.ln("OK")
| nonexistent _ |> std.io:print.ln("BAD")
input.kz

Test Configuration

Expected Behavior:

BACKEND_COMPILE_ERROR