050 expand basic

✓ Passing This code compiles and runs correctly.

Code

// Test: [expand] annotation for template-based code generation
// This tests the simplest case: an event with [expand] that uses a template
// to generate inline Zig code without needing a proc.

~import "$std/template"

// Define template in user-land using the imported define event
~std.template:define(name: "debug_print") {
    @import("std").debug.print("value: {d}\n", .{ {{ value }} });
}

// Event with [norun|expand] - implementation comes from template
// [norun] = not emitted anywhere
// [expand] = processed by transform_pass_runner via template lookup
~[norun|expand]pub event debug_print { value: Expression }

// Use it - note the ~ prefix to make it a Koru flow!
~debug_print(value: 42)
input.kz

Expected Output

value: 42

Test Configuration

MUST_RUN