Open
Description
Zig Version
0.14.0-dev.2126+e27b4647d
Steps to Reproduce and Observed Output
fn Wrap(content: anytype) type {
return struct {
x: u32,
comptime {
_ = content;
}
};
}
pub fn main() void {
const A = Wrap(.{ .hello = 1 });
const B = Wrap(.{ .hello = 1 });
const b: A = @as(B, .{ .x = 2 });
_ = b;
}
repro.zig:14:18: error: expected type 'repro.Wrap(.{ .hello = 1 })', found 'repro.Wrap(.{ .hello = 1 })'
Expected Output
When I hit this error in a more complicated situation I realized it was from #21817, but only because i was already aware that change was going to happen. To someone who is unaware, this message is very odd because the types look to be the same.
I'm not sure exactly how to convey the two unique types. Maybe at the minimum using a note saying that different instantiations of anonymous unions create different types, or the struct name shouldn't be .
but some generated name.