zig/test/cases/compile_errors/generic_instantiation_failure.zig
r00ster91 60830e36e3 Sema error: talk about discarding instead of suppressing
Maybe I'm just being pedantic here (most likely) but I don't like how we're
just telling the user here how to "suppress this error" by "assigning the value to '_'".
I think it's better if we use the word "discard" here which I think is
the official terminology and also tells the user what it actually means
to "assign the value to '_'".

Also, using the value would also be a way to "suppress the error".
It is just one of the two options: discard or use.
2024-05-14 01:13:48 +09:00

27 lines
674 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: to discard the value, assign it to '_'