✓
Passing This code compiles and runs correctly.
Code
// Test 906: Emitter Inline Flow Numbering Bug
//
// BUG: When multiple procs have inline flows, the emitter generates
// incorrect function references - calling __inline_flow_1 from different
// procs but each proc should call its own numbered inline flows.
//
// This minimal test reproduces the bug:
// - proc1 has inline flow that calls helper(value: 10)
// - proc2 has inline flow that calls helper(value: 20)
// - Both inline flows are numbered __inline_flow_1 and __inline_flow_2
// - But proc2 tries to call __inline_flow_1 with wrong argument type
//
// Expected: Each proc correctly calls its own inline flow function
// Actual: Wrong inline flow function referenced, causing type mismatch
const std = @import("std");
~event helper { value: i32 }
| ok { doubled: i32 }
~proc helper {
return .{ .ok = .{ .doubled = value * 2 } };
}
~event proc1 { }
| result { value: i32 }
~proc proc1 = helper(value: 10)
| ok o |> result { value: o.doubled * 2 }
~event proc2 { }
| result { value: i32 }
~proc proc2 = helper(value: 20)
| ok o |> result { value: o.doubled + 10 }
~event test_expressions { }
| done { }
~proc test_expressions {
// Call proc1: helper doubles 10 to 20, then branch constructor multiplies by 2 = 40
const r1 = proc1_event.handler(.{});
std.debug.assert(r1.result.value == 40);
std.debug.print("✅ proc1 * 2 = {}\n", .{r1.result.value});
// Call proc2: helper doubles 20 to 40, then branch constructor adds 10 = 50
const r2 = proc2_event.handler(.{});
std.debug.assert(r2.result.value == 50);
std.debug.print("✅ proc2 + 10 = {}\n", .{r2.result.value});
return .{ .done = .{} };
}
// Test: verify proc flow expressions work
~test_expressions()
| done |> _
Expected Output
✅ proc1 * 2 = 40
✅ proc2 + 10 = 50
Test Configuration
MUST_RUN