✓
Passing This code compiles and runs correctly.
Code
// Test 235: Loop with imported module event (MUST_FAIL - documents known bug)
//
// BUG: #loop module:event() fails with "Event not found"
// when the event comes from an imported module.
//
// Error: "COMPILER BUG: Cannot find event declaration for loop variable"
//
// This is a regression test to track when the bug is fixed.
~import "$app/mylib"
// The loop uses an event from the imported module
~#loop app.mylib:tick()
| next _ |> @loop()
| done |> _
Imported Files
// Simple module with a tick event for loop testing
const std = @import("std");
~pub event tick {}
| next { n: u32 }
| done {}
~proc tick {
const static = struct { var count: u32 = 0; };
static.count += 1;
if (static.count < 3) {
return .{ .next = .{ .n = static.count } };
}
return .{ .done = .{} };
}