✓
Passing This code compiles and runs correctly.
Code
// ============================================================================
// CHAOS MODE: Depth 5 with Multiple Branches
// ============================================================================
// This tests the FULL complexity:
// - 5 levels deep
// - Multiple branches at each level (ok/error)
// - Error handling propagation
// - Should expose ALL the bootstrap bugs at once!
// ============================================================================
~import std/io
~event validate { value: i32 }
| ok i32
| failure []const u8
~proc validate|zig {
if (value > 0) {
return .{ .ok = value };
} else {
return .{ .failure = "negative" };
}
}
~event double { value: i32 }
| ok i32
| failure []const u8
~proc double|zig {
if (value < 100) {
return .{ .ok = value * 2 };
} else {
return .{ .failure = "too large" };
}
}
// Chain with failure handling at each level
~event process { input: i32 }
| success i32
| failed []const u8
~process = validate(value: input)
| ok a |> double(value: a)
| ok b |> validate(value: b)
| ok c |> double(value: c)
| ok d |> validate(value: d)
| ok final_ok => success final_ok
| failure e_err => failed e_err
| failure d_err => failed d_err
| failure c_err => failed c_err
| failure b_err => failed b_err
| failure a_err => failed a_err
~process(input: 1)
| success s |> std/io:print.ln("Success: {{ s:d }}")
| failed f |> std/io:print.ln("Failed: {{ f:s }}")Actual
Success: 4
Expected output
Success: 4
Test Configuration
MUST_RUN