✓
Passing This code compiles and runs correctly.
Code
// ============================================================================
// VERIFIED REGRESSION TEST - DO NOT MODIFY WITHOUT DISCUSSION
// ============================================================================
// Test 205: Nested continuation labels
// Tests that labels can be nested at different continuation depths
// ============================================================================
const std = @import("std");
// Outer counter event (counts outer iterations)
~event outer { x: i32, max_inner: i32 }
| next-outer { x: i32, max_inner: i32 }
| done-outer
~proc outer|zig {
std.debug.print("Outer: {}\n", .{x});
if (x < 3) {
return .{ .next_outer = .{ .x = x, .max_inner = max_inner } };
} else {
return .{ .done_outer = .{} };
}
}
// Inner counter event (counts inner iterations)
~event inner { x: i32, y: i32, max_inner: i32 }
| next-inner { x: i32, y: i32, max_inner: i32 }
| done-inner { x: i32, max_inner: i32 }
~proc inner|zig {
std.debug.print(" Inner: {}, {}\n", .{x, y});
if (y < max_inner) {
return .{ .next_inner = .{ .x = x, .y = y + 1, .max_inner = max_inner } };
} else {
return .{ .done_inner = .{ .x = x + 1, .max_inner = max_inner } };
}
}
// Start event
~event start {}
~proc start|zig {
std.debug.print("Starting nested loops...\n", .{});
}
// Flow with nested labels
// Both loops now have matching signatures (x: i32, max-inner: i32)
~start() |> #outer_loop outer(x: 1, max_inner: 2)
| next-outer o |> #inner_loop inner(o.x, y: 1, o.max_inner)
| next-inner i |> @inner_loop(i.x, i.y, i.max_inner)
| done-inner d |> @outer_loop(d.x, d.max_inner)
| done-outer |> _
Actual
Starting nested loops...
Outer: 1
Inner: 1, 1
Inner: 1, 2
Outer: 2
Inner: 2, 1
Inner: 2, 2
Outer: 3
Expected output
Starting nested loops...
Outer: 1
Inner: 1, 1
Inner: 1, 2
Outer: 2
Inner: 2, 1
Inner: 2, 2
Outer: 3
Test Configuration
MUST_RUN