009 universal wildcard metatype

✓ Passing This code compiles and runs correctly.

Code

// Test 182: Universal Wildcard + Metatype (VALID)
//
// Pattern: ~*:* -> * | Profile p |>
//
// This is VALID because:
// - Source is universal wildcard (*:*) - matches ALL events
// - Branch is metatype (Profile) - works on any event/branch combination
// - Metatypes are polymorphic - they don't depend on specific branch shapes

const std = @import("std");

~import "$app/test_lib/logger"

~event compute { x: i32 }
| result { value: i32 }

~event format { value: i32 }
| formatted { text: []const u8 }

~proc compute {
    std.debug.print("compute({d})\n", .{x});
    return .{ .result = .{ .value = x * 2 } };
}

~proc format {
    std.debug.print("format({d})\n", .{value});
    return .{ .formatted = .{ .text = "formatted" } };
}

~compute(x: 42)
| result r |> format(value: r.value)
    | formatted |> _
input.kz

Expected Output

[TAP] Profile: koru:start.done
compute(42)
[TAP] Profile: input:compute.result
format(84)
[TAP] Profile: input:format.formatted
[TAP] Profile: koru:end.done

Imported Files

// Logger with universal wildcard + metatype tap

~import "$std/taps"
const std = @import("std");

~pub event log { source: []const u8, branch: []const u8 }
| done {}

~proc log {
    std.debug.print("[TAP] Profile: {s}.{s}\n", .{source, branch});
    return .{ .done = .{} };
}

// VALID: Universal wildcard (*:*) + metatype (Profile)
// Profile metatype works on ANY event and ANY branch
~tap(*:* -> *)
| Profile p |> log(source: p.source, branch: p.branch)
    | done |> _
test_lib/logger.kz

Test Configuration

MUST_RUN