zig fmt: fix typo in firstToken() for pointer types

This commit is contained in:
Isaac Freund 2021-02-10 13:02:37 +01:00 committed by Andrew Kelley
parent 58db3d2775
commit 80b719d967
2 changed files with 25 additions and 25 deletions

View File

@ -408,10 +408,10 @@ pub const Tree = struct {
const main_token = main_tokens[n];
return switch (token_tags[main_token]) {
.Asterisk => switch (token_tags[main_token - 1]) {
.LBrace => main_token - 1,
.LBracket => main_token - 1,
else => main_token,
},
.LBrace => main_token,
.LBracket => main_token,
else => unreachable,
} - end_offset;
},

View File

@ -423,16 +423,16 @@ test "zig fmt: sentinel slice with modifiers" {
);
}
//test "zig fmt: anon literal in array" {
// try testCanonical(
// \\var arr: [2]Foo = .{
// \\ .{ .a = 2 },
// \\ .{ .b = 3 },
// \\};
// \\
// );
//}
//
test "zig fmt: anon literal in array" {
try testCanonical(
\\var arr: [2]Foo = .{
\\ .{ .a = 2 },
\\ .{ .b = 3 },
\\};
\\
);
}
//test "zig fmt: alignment in anonymous literal" {
// try testTransform(
// \\const a = .{
@ -751,12 +751,12 @@ test "zig fmt: tagged union with enum values" {
);
}
//test "zig fmt: allowzero pointer" {
// try testCanonical(
// \\const T = [*]allowzero const u8;
// \\
// );
//}
test "zig fmt: allowzero pointer" {
try testCanonical(
\\const T = [*]allowzero const u8;
\\
);
}
test "zig fmt: enum literal" {
try testCanonical(
@ -806,13 +806,13 @@ test "zig fmt: character literal larger than u8" {
// \\
// );
//}
//
//test "zig fmt: C pointers" {
// try testCanonical(
// \\const Ptr = [*c]i32;
// \\
// );
//}
test "zig fmt: C pointers" {
try testCanonical(
\\const Ptr = [*c]i32;
\\
);
}
test "zig fmt: threadlocal" {
try testCanonical(