✓
Passing This code compiles and runs correctly.
Code
// Test 918c: Optional Branches - Ignored Without |? Catch-All
//
// Verifies:
// 1. Optional branches can be COMPLETELY IGNORED
// 2. No |? catch-all needed for optional branches
// 3. Only required branches need handlers
~import "$std/io"
// Event with required + multiple optional branches
// success is REQUIRED, warning and debug are OPTIONAL (ignored)
~event analyze { value: u32 }
| success u32
| ?warning []const u8
| ?debug []const u8
~proc analyze {
if (value > 100) {
return .{ .warning = "Large value" };
}
return .{ .success = value * 2 };
}
// value=50 → success
~analyze(value: 50)
| success _ |> std.io:print.ln("SUCCESS")
// No warning handler, no |? — optional branches just ignored
// value=150 → warning (optional, no handler — silently ignored)
~analyze(value: 150)
| success _ |> std.io:print.ln("SUCCESS")
Expected
SUCCESS
Actual
SUCCESS
Test Configuration
MUST_RUN