035 circular imports

✓ Passing This code compiles and runs correctly.

Code

// Test: Circular Imports
//
// input.kz imports module_b.kz, which imports input.kz back.
// Proves: (1) circular imports compile without infinite loop,
//         (2) cross-module dispatch works in BOTH directions across the cycle.
//
// Flow: top-level invokes module_b's event, which calls back into input's
// event, which prints. If any link in the cycle breaks, the expected
// output disappears and the test fails loudly.

~import "$app/module_b"

const std = @import("std");

~pub event from_a { msg: []const u8 }
| received []const u8

~proc from_a {
    std.debug.print("input.kz received: {s}\n", .{msg});
    return .{ .received = msg };
}

~app.module_b:from_b(msg: "hello from input")
| relayed _ |> _
input.kz

Expected

input.kz received: hello from input

Actual

input.kz received: hello from input

Imported Files

// Module B - imports input.kz back, closing the cycle.
// from_b dispatches back into input's from_a, then relays its result.

~import "$app/input"

~pub event from_b { msg: []const u8 }
| relayed []const u8

~from_b = app.input:from_a(msg: msg)
    | received r |> relayed r
module_b.kz

Test Configuration

MUST_RUN