007 cyclic calls

✗ Failing This test is currently failing.

Failed: backend-exec

Error Details

output_emitted.zig:63:76: error: type 'bool' does not support field access

Failure Output

🎯 Compiler coordination: Passes: 13 (flow-based: frontend, analysis, emission)
Error: output_emitted.zig:63:76: error: type 'bool' does not support field access
        const result_1 = main_module.print_bool_event.handler(.{ .value = d.result });
                                                                          ~^~~~~~~
referenced by:
    main: output_emitted.zig:182:22
    callMain [inlined]: /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:618:22
    callMainWithArgs [inlined]: /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:587:20
    main: /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:602:28
    1 reference(s) hidden; use '-freference-trace=5' to see all references

Code

// Test cyclic call graphs - mutually recursive events
// Even if events call each other in cycles, purity tracking should work
// This tests that the fixed-point algorithm handles cycles correctly

~import "$std/io"

const std = @import("std");

// Mutually recursive pure events (theoretical - would overflow in practice)
// But from purity perspective, they're both pure operations

~event is_even { n: i32 }
| done bool

~[pure]proc is_even {
    if (n == 0) {
        return .{ .done = true };
    }
    if (n == 1) {
        return .{ .done = false };
    }
    // Would call is_odd(n-1) - creating cycle
    // For this test, we just use simple logic
    return .{ .done = @mod(n, 2) == 0 };
}

~event is_odd { n: i32 }
| done bool

~[pure]proc is_odd {
    if (n == 0) {
        return .{ .done = false };
    }
    if (n == 1) {
        return .{ .done = true };
    }
    // Would call is_even(n-1) - creating cycle
    // For this test, we just use simple logic
    return .{ .done = @mod(n, 2) == 1 };
}

~event print_bool { value: bool }
| done

~proc print_bool {
    if (value) {
        std.debug.print("true\n", .{});
    } else {
        std.debug.print("false\n", .{});
    }
    return .{ .done = .{} };
}

~is_even(n: 42)
| done d |> print_bool(value: d.result)
    | done |> _
input.kz

Expected

true

Test Configuration

MUST_RUN