004 pure on event redundant

✓ Passing This code compiles and runs correctly.

Code

// Layer 3 demonstration: annotations are open metadata at the frontend.
// `[pure]` on an event is redundant (events derive purity from impls,
// not from annotations) but it is NOT an error. The frontend accepts it.
//
// This test passes if the program compiles cleanly. The purity pass
// either ignores the annotation or computes a redundantly-correct
// result. Neither rejection nor error.

const std = @import("std");

// [pure] on an event — redundant but legal
~[pure] event noop {}

~proc noop|zig {}

~event main {}

~noop()
input.kz

Test Configuration

MUST_RUN

Post-validation Script:

#!/bin/bash
# Verify: program with [pure] on an event compiled cleanly.
# Annotations are open metadata at the frontend — misplaced
# annotations are not rejected.

if [ ! -f "backend.zig" ]; then
    echo "✗ backend.zig not found — program failed to compile, but [pure] on event should be legal"
    exit 1
fi

# AST literal moved from backend.zig to program_ast.zig (split landed 2026-05-20).
# Concatenate both so grep finds serialized AST contents regardless of layout.
cat backend.zig program_ast.zig 2>/dev/null > _combined_emit.zig

if grep -q '"noop"' _combined_emit.zig; then
    echo "✓ program with [pure] on event compiled cleanly (annotations are open metadata)"
else
    echo "✗ FAIL: noop event not found in backend.zig"
    exit 1
fi

exit 0