Skip to content

Commit 8829b53

Browse files
authored
Merge pull request #3849 from Vexu/fix-fmt
Fix zig fmt c pointer return type
2 parents bef3769 + d40ad92 commit 8829b53

File tree

3 files changed

+140
-130
lines changed

3 files changed

+140
-130
lines changed

lib/std/zig/parse.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2558,7 +2558,7 @@ fn parsePtrTypeStart(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node
25582558
_ = try expectToken(it, tree, .RBracket);
25592559
const node = try arena.create(Node.PrefixOp);
25602560
node.* = .{
2561-
.op_token = ident,
2561+
.op_token = lbracket,
25622562
.op = .{ .PtrType = .{} },
25632563
.rhs = undefined, // set by caller
25642564
};

lib/std/zig/parser_test.zig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
test "zig fmt: c pointer type" {
2+
try testCanonical(
3+
\\pub extern fn repro() [*c]const u8;
4+
\\
5+
);
6+
}
7+
18
test "zig fmt: asm expression with comptime content" {
29
try testCanonical(
310
\\comptime {
@@ -21,6 +28,7 @@ test "zig fmt: asm expression with comptime content" {
2128
\\
2229
);
2330
}
31+
2432
test "zig fmt: var struct field" {
2533
try testCanonical(
2634
\\pub const Pointer = struct {

0 commit comments

Comments
 (0)