parser: allow unnamed fields in structs
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
test "zig fmt: tuple struct" {
|
||||
try testCanonical(
|
||||
\\const T = struct {
|
||||
\\ comptime u32,
|
||||
\\ *u32 = 1,
|
||||
\\ // needs to be wrapped in parentheses to not be parsed as a function decl
|
||||
\\ (fn () void) align(1),
|
||||
\\};
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: preserves clobbers in inline asm with stray comma" {
|
||||
try testCanonical(
|
||||
\\fn foo() void {
|
||||
@@ -265,14 +277,6 @@ test "zig fmt: decl between fields" {
|
||||
});
|
||||
}
|
||||
|
||||
test "zig fmt: eof after missing comma" {
|
||||
try testError(
|
||||
\\foo()
|
||||
, &[_]Error{
|
||||
.expected_comma_after_field,
|
||||
});
|
||||
}
|
||||
|
||||
test "zig fmt: errdefer with payload" {
|
||||
try testCanonical(
|
||||
\\pub fn main() anyerror!void {
|
||||
@@ -5732,8 +5736,8 @@ test "recovery: missing semicolon" {
|
||||
test "recovery: invalid container members" {
|
||||
try testError(
|
||||
\\usingnamespace;
|
||||
\\foo+
|
||||
\\bar@,
|
||||
\\@foo()+
|
||||
\\@bar()@,
|
||||
\\while (a == 2) { test "" {}}
|
||||
\\test "" {
|
||||
\\ a & b
|
||||
@@ -5741,7 +5745,7 @@ test "recovery: invalid container members" {
|
||||
, &[_]Error{
|
||||
.expected_expr,
|
||||
.expected_comma_after_field,
|
||||
.expected_container_members,
|
||||
.expected_type_expr,
|
||||
.expected_semi_after_stmt,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user