authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-02-10 13:02:37+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-02-10 11:53:53-08:00
log80b719d967d7241182e237b42ade1cd88494c8e8
treec6d946a59bbcdd12d9d178318ad7e51cd620033e
parent58db3d27753709074fba7c88923754dd1c1a0ed9

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


2 files changed, 25 insertions(+), 25 deletions(-)

lib/std/zig/ast.zig+2-2
......@@ -408,10 +408,10 @@ pub const Tree = struct {
408408 const main_token = main_tokens[n];
409409 return switch (token_tags[main_token]) {
410410 .Asterisk => switch (token_tags[main_token - 1]) {
411 .LBrace => main_token - 1,
411 .LBracket => main_token - 1,
412412 else => main_token,
413413 },
414 .LBrace => main_token,
414 .LBracket => main_token,
415415 else => unreachable,
416416 } - end_offset;
417417 },
lib/std/zig/parser_test.zig+23-23
......@@ -423,16 +423,16 @@ test "zig fmt: sentinel slice with modifiers" {
423423 );
424424}
425425
426//test "zig fmt: anon literal in array" {
427// try testCanonical(
428// \\var arr: [2]Foo = .{
429// \\ .{ .a = 2 },
430// \\ .{ .b = 3 },
431// \\};
432// \\
433// );
434//}
435//
426test "zig fmt: anon literal in array" {
427 try testCanonical(
428 \\var arr: [2]Foo = .{
429 \\ .{ .a = 2 },
430 \\ .{ .b = 3 },
431 \\};
432 \\
433 );
434}
435
436436//test "zig fmt: alignment in anonymous literal" {
437437// try testTransform(
438438// \\const a = .{
......@@ -751,12 +751,12 @@ test "zig fmt: tagged union with enum values" {
751751 );
752752}
753753
754//test "zig fmt: allowzero pointer" {
755// try testCanonical(
756// \\const T = [*]allowzero const u8;
757// \\
758// );
759//}
754test "zig fmt: allowzero pointer" {
755 try testCanonical(
756 \\const T = [*]allowzero const u8;
757 \\
758 );
759}
760760
761761test "zig fmt: enum literal" {
762762 try testCanonical(
......@@ -806,13 +806,13 @@ test "zig fmt: character literal larger than u8" {
806806// \\
807807// );
808808//}
809//
810//test "zig fmt: C pointers" {
811// try testCanonical(
812// \\const Ptr = [*c]i32;
813// \\
814// );
815//}
809
810test "zig fmt: C pointers" {
811 try testCanonical(
812 \\const Ptr = [*c]i32;
813 \\
814 );
815}
816816
817817test "zig fmt: threadlocal" {
818818 try testCanonical(