012 registry dispatch test

✓ Passing This code compiles and runs correctly.

Code

// Test: Runtime Registry Dispatch
// Minimal test to verify the generated dispatcher works

~import "$std/runtime"

const std = @import("std");

// Simple event to dispatch to
~pub event greet { name: []const u8 }
| greeted { message: []const u8 }

~proc greet {
    std.debug.print("GREET CALLED with name: {s}\n", .{name});
    return .{ .greeted = .{ .message = "Hello!" } };
}

// Register just this one event
~std.runtime:register(scope: "test") {
    greet
}

// Entry point - uses the dispatcher's inline types
pub fn main() void {
    std.debug.print("=== DISPATCH TEST ===\n", .{});

    // Create a fake invocation for "greet" using inline types
    const segments = [_][]const u8{"greet"};
    const path = Path{
        .module_qualifier = null,
        .segments = &segments,
    };

    var args_array = [_]Arg{
        .{
            .name = "name",
            .value = "World",
        },
    };

    const inv = Invocation{
        .path = path,
        .args = &args_array,
    };

    // Call the dispatcher with result output!
    var result: DispatchResult = undefined;
    dispatch_test(&inv, &result) catch |err| {
        std.debug.print("Dispatch error: {}\n", .{err});
        return;
    };

    // Print the result - this is what the interpreter would use!
    std.debug.print("=== DISPATCH SUCCESS ===\n", .{});
    std.debug.print("Branch: {s}\n", .{result.branch});
    std.debug.print("Fields: {d}\n", .{result.fields.len});
}
input.kz