✓
Passing This code compiles and runs correctly.
Code
// Test that demonstrates flow purity concept
// Flows compose events - they don't execute code themselves
// This test verifies the AST structure supports purity tracking on flows
~import "$std/io"
// Pure event
~event add { x: i32, y: i32 }
| done { result: i32 }
~[pure]proc add {
return .{ .done = .{ .result = x + y } };
}
// Flow that composes pure operations
~event calculate { a: i32, b: i32, c: i32 }
| done { result: i32 }
~calculate = add(x: a, y: b)
| done d1 |> add(x: d1.result, y: c)
| done d2 |> done { result: d2.result }
~calculate(a: 10, b: 20, c: 12)
| done d |> std.io:print.ln("Result: {{ d.result:d }}")
Expected
Result: 42
Actual
Result: 42
Test Configuration
MUST_RUN