This logic was previously in Sema, which was unnecessary complexity, and meant the issue was not detected unless the declaration was semantically analyzed. This commit finishes the work which 941090d started.
Resolves: #17916
18 lines
287 B
Zig
18 lines
287 B
Zig
const E = enum { a, b };
|
|
const U = union(E) {
|
|
a: u32,
|
|
a: u32,
|
|
};
|
|
|
|
export fn foo() void {
|
|
const u: U = .{ .a = 123 };
|
|
_ = u;
|
|
}
|
|
|
|
// error
|
|
// target=native
|
|
//
|
|
// :3:5: error: duplicate union field name
|
|
// :4:5: note: duplicate field here
|
|
// :2:11: note: union declared here
|