mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-07 06:14:33 +00:00
This is all of the expected 0.14.0 progress on #21530, which can now be postponed once this commit is merged. This required rewriting the (un)wrap operations since the original implementations were extremely buggy. Also adds an easy way to retrigger Sema OPV bugs so that I don't have to keep updating #22419 all the time.
27 lines
676 B
Zig
27 lines
676 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=stage2
|
|
// target=native
|
|
//
|
|
// :18:43: error: value of type 'type' ignored
|
|
// :18:43: note: all non-void values must be used
|
|
// :18:43: note: to discard the value, assign it to '_'
|