mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 00:08:56 +00:00
parent
e2adf3b61a
commit
1658e4893d
@ -4487,9 +4487,24 @@ fn structDeclInner(
|
||||
.container_field_align,
|
||||
.container_field,
|
||||
.@"comptime",
|
||||
.test_decl,
|
||||
=> continue,
|
||||
else => {
|
||||
return astgen.failNode(member_node, "tuple declarations cannot contain declarations", .{});
|
||||
const tuple_member = for (container_decl.ast.members) |maybe_tuple| switch (node_tags[maybe_tuple]) {
|
||||
.container_field_init,
|
||||
.container_field_align,
|
||||
.container_field,
|
||||
=> break maybe_tuple,
|
||||
else => {},
|
||||
} else unreachable;
|
||||
return astgen.failNodeNotes(
|
||||
member_node,
|
||||
"tuple declarations cannot contain declarations",
|
||||
.{},
|
||||
&[_]u32{
|
||||
try astgen.errNoteNode(tuple_member, "tuple field here", .{}),
|
||||
},
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@ -23,3 +23,4 @@ const T = struct {
|
||||
// :5:5: error: union field missing name
|
||||
// :8:5: error: tuple field has a name
|
||||
// :15:5: error: tuple declarations cannot contain declarations
|
||||
// :12:5: note: tuple field here
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user