sema: add compile error for duplicate struct field
This commit is contained in:
15
test/compile_errors/stage2/struct_duplicate_field_name.zig
Normal file
15
test/compile_errors/stage2/struct_duplicate_field_name.zig
Normal file
@@ -0,0 +1,15 @@
|
||||
const S = struct {
|
||||
foo: u32,
|
||||
foo: u32,
|
||||
};
|
||||
|
||||
export fn entry() void {
|
||||
const s: S = .{ .foo = 100 };
|
||||
_ = s;
|
||||
}
|
||||
|
||||
// duplicate struct field name
|
||||
//
|
||||
// :3:5: error: duplicate struct field: 'foo'
|
||||
// :2:5: note: other field here
|
||||
// :1:11: note: struct declared here
|
||||
Reference in New Issue
Block a user