?
Unknown Status unknown.
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 {}
~proc test_option|zig {
const opt = OptionalInt{ .value = 42 };
if (opt.value) |v| {
std.debug.print("Got: {d}\n", .{v});
}
}
~test_option()
Actual
Got: 42
Must contain:
Got: 42Test Configuration
MUST_RUN