005 impure event error

✓ Passing This code compiles and runs correctly.

Code

// Test: Impure events require overrides
// MUST_FAIL: has impure events without overrides
//
// When a test calls an impure event (Zig proc without ~[pure]),
// the compiler should error and list ALL impure events at once.
//
// This is the "fix/recompile loop killer" - great UX!

~import "$std/testing"

// Impure event - Zig proc without ~[pure]
~event fetch_user { id: u32 }
| found []const u8
| not_found

~proc fetch_user {
    // This is impure - does I/O (simulated)
    return .{ .found = "Alice" };
}

// Another impure event
~event save_log { message: []const u8 }
| saved

~proc save_log {
    // This is impure - writes to disk
    return .{ .saved = .{} };
}

// Test: Should FAIL - calls impure events without overrides
~test(Impure events should error) {
    ~fetch_user(id: 1)
    | found u |>
        save_log(message: u.name)
        | saved |> assert.ok()
}

pub fn main() void {}
input.kz

Error Verification

Expected Error Pattern

MUST_FAIL

Actual Compiler Output

[TEST] Building mock lookup map
[TEST] Transformed program has 16 items:
[TEST]   [0] flow
[TEST]       invocation: fetch_user
[TEST]   [1] other
[TEST]   [2] other
[TEST]   [3] other
[TEST]   [4] other
[TEST]   [5] other
[TEST]   [6] other
[TEST]   [7] other
[TEST]   [8] other
[TEST]   [9] event_decl
[TEST]   [10] proc_decl
[TEST]   [11] other
[TEST]   [12] event_decl
[TEST]   [13] proc_decl
[TEST]   [14] other
[TEST]   [15] other
[TEST] Found 1 transformed flows
[TEST] SKIPPING purity walk for debugging
[TEST] Purity walk complete, 0 impure events
🎯 Compiler coordination: Passes: 13 (flow-based: frontend, analysis, emission)

Test Configuration

MUST_FAIL