✓
Passing This code compiles and runs correctly.
Code
// Test: Optional branches require catch-all when not explicitly handled
//
// MUST_FAIL
//
// Optional branches (| ?name) don't need individual handling,
// but if ANY are unhandled, a catch-all (|? |> _) is REQUIRED.
// This prevents silent data loss.
//
// Expected: Compile error about missing catch-all for optional branches
const std = @import("std");
~event process { value: u32 }
| success { result: u32 }
| ?warning { msg: []const u8 }
| ?debug { details: []const u8 }
~proc process {
if (value > 100) {
return .{ .warning = .{ .msg = "Large value" } };
}
return .{ .success = .{ .result = value * 2 } };
}
// This should FAIL - optional branches exist but no catch-all
~process(value: 10)
| success |> _
// Missing: |? |> _
Test Configuration
MUST_FAIL