mirror of
https://github.com/ziglang/zig.git
synced 2025-12-12 09:13:11 +00:00
28 lines
694 B
Zig
28 lines
694 B
Zig
fn List(comptime Head: type, comptime Tail: type) type {
|
|
return union {
|
|
const Self = @This();
|
|
head: Head,
|
|
tail: Tail,
|
|
|
|
fn AppendReturnType(comptime item: anytype) type {
|
|
return List(Head, List(@TypeOf(item), void));
|
|
}
|
|
};
|
|
}
|
|
|
|
fn makeList(item: anytype) List(@TypeOf(item), void) {
|
|
return List(@TypeOf(item), void){ .head = item };
|
|
}
|
|
|
|
pub export fn entry() void {
|
|
@TypeOf(makeList(42)).AppendReturnType(64);
|
|
}
|
|
|
|
// error
|
|
// backend=llvm
|
|
// target=native
|
|
//
|
|
// :18:43: error: value of type 'type' ignored
|
|
// :18:43: note: all non-void values must be used
|
|
// :18:43: note: this error can be suppressed by assigning the value to '_'
|