✓
Passing This code compiles and runs correctly.
Code
// ============================================================================
// VERIFIED REGRESSION TEST - DO NOT MODIFY WITHOUT DISCUSSION
// ============================================================================
// Test 206: Label scope errors
// Tests that labels are flow-scoped and cannot be accessed across flows
// Expected to fail compilation with "Unknown label 'loop'" error
// ============================================================================
const std = @import("std");
// Simple counter event
~tor counter { n: i32 }
| next i32
| done i32
~proc counter|zig {
std.debug.print("Count: {}\n", .{n});
if (n < 3) {
return .{ .next = n + 1 };
} else {
return .{ .done = n };
}
}
// Start event
~tor start {}
~proc start|zig {
std.debug.print("Starting...\n", .{});
}
// Flow 1 with a label
~start() |> #loop counter(n: 1)
| next c |> @loop(n: c.value)
| done |> _
// Flow 2 trying to jump to Flow 1's label (should error!)
~start() |> @loop(n: 1) // ERROR: 'loop' is not in scope here
Must contain:
unknown labelFlows
flow ~start click a branch to expand · @labels scroll to their anchor
start
flow ~start click a branch to expand · @labels scroll to their anchor
start