zig/test/cases/compile_errors/generic_instantiation_failure.zig
Jacob Young 8159ff8b81 x86_64: implement error set and enum safety
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.
2025-02-15 03:45:21 -05:00

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 '_'