110 generic struct basic

✓ Passing This code compiles and runs correctly.

Code

// TEST: ~struct with single type parameter
//
// ~struct(Option<T>) { value: ?T = null } defines a generic struct
// ~type(OptionalInt = Option<i32>) instantiates it with concrete type.
//
// Expected: Compiles and runs with instantiated generic

~import "$std/types"

const std = @import("std");

~struct(Option<T>) { value: ?T = null }

// Instantiate it with ~type
~type(OptionalInt = Option<i32>)

~event test_option {}
| done {}

~proc test_option {
    const opt = OptionalInt{ .value = 42 };
    if (opt.value) |v| {
        std.debug.print("Got: {d}\n", .{v});
    }
    return .{ .done = .{} };
}

~test_option()
| done |> _
input.kz

Actual

Got: 42

Test Configuration

MUST_RUN

Expected Behavior:

CONTAINS Got: 42