| author | |
| committer | |
| log | 9b8a94265ab7313f07b300ddc349a60c85d556d1 |
| tree | 80ca48193b327cc749d404292878186399182627 |
| parent | 5f35dc0c0d0530d5a1d028c56a763def3d1fd250 |
Regressed in d7049fc8e0709619b8aa6766b37abeae946703b2.2 files changed, 15 insertions(+), 2 deletions(-)
lib/std/zig/parser_test.zig+11| ... | ... | @@ -4190,6 +4190,17 @@ test "zig fmt: function with labeled block as return type" { |
| 4190 | 4190 | ); |
| 4191 | 4191 | } |
| 4192 | 4192 | |
| 4193 | test "zig fmt: extern function with missing param name" { | |
| 4194 | try testCanonical( | |
| 4195 | \\extern fn a( | |
| 4196 | \\ *b, | |
| 4197 | \\ c: *d, | |
| 4198 | \\) e; | |
| 4199 | \\extern fn f(*g, h: *i) j; | |
| 4200 | \\ | |
| 4201 | ); | |
| 4202 | } | |
| 4203 | ||
| 4193 | 4204 | test "zig fmt: line comment after multiline single expr if statement with multiline string" { |
| 4194 | 4205 | try testCanonical( |
| 4195 | 4206 | \\test { |
lib/std/zig/render.zig+4-2| ... | ... | @@ -1449,9 +1449,11 @@ fn renderFnProto(gpa: *Allocator, ais: *Ais, tree: ast.Tree, fn_proto: ast.full. |
| 1449 | 1449 | continue; |
| 1450 | 1450 | }, |
| 1451 | 1451 | .r_paren => break, |
| 1452 | else => unreachable, | |
| 1452 | else => {}, // Parameter type without a name. | |
| 1453 | 1453 | } |
| 1454 | if (token_tags[last_param_token] == .identifier) { | |
| 1454 | if (token_tags[last_param_token] == .identifier and | |
| 1455 | token_tags[last_param_token + 1] == .colon) | |
| 1456 | { | |
| 1455 | 1457 | try renderToken(ais, tree, last_param_token, .none); // name |
| 1456 | 1458 | last_param_token += 1; |
| 1457 | 1459 | try renderToken(ais, tree, last_param_token, .space); // : |