✓
Passing This code compiles and runs correctly.
Code
// BUG: print.ln inline code ordering in nested for loop with void events
//
// REPRODUCTION: Matches the nbody pattern exactly:
// - for loop with void events in | each |
// - branched event in | done |
// - print.ln using the branch binding
const std = @import("std");
~import std/control
~import std/io
// Void event (like advance-velocities)
~event step-one {}
~proc step-one|zig {}
// Another void event (like advance-positions)
~event step-two {}
~proc step-two|zig {}
// Branched event (like calculate-energy)
~event get-result {}
| value i32
~proc get-result|zig {
return .{ .value = 42 };
}
// Print event with a result (like print-energy)
~event print-value { v: i32 }
~proc print-value|zig {
std.debug.print("{d}\n", .{v});
}
// Initial setup (like initialize-bodies)
~event setup {}
| ready i32
~proc setup|zig {
return .{ .ready = 1 };
}
// Main flow - matches nbody structure
~setup()
| ready _ |> get-result()
| value v1 |> print-value(v: v1) |> for(0..3)
! each _ |> step-one() |> step-two()
| done |> get-result()
| value v2 |> std/io:print.ln("Result: {{ v2:d }}")
Actual
42
Result: 42
Test Configuration
MUST_RUN