| ... | ... | @@ -4049,45 +4049,45 @@ test "zig fmt: allow trailing line comments to do manual array formatting" { |
| 4049 | 4049 | // ); |
| 4050 | 4050 | //} |
| 4051 | 4051 | |
| 4052 | | //test "zig fmt: use of comments and Multiline string literals may force the parameters over multiple lines" { |
| 4053 | | // try testCanonical( |
| 4054 | | // \\pub fn makeMemUndefined(qzz: []u8) i1 { |
| 4055 | | // \\ cases.add( // fixed bug #2032 |
| 4056 | | // \\ "compile diagnostic string for top level decl type", |
| 4057 | | // \\ \\export fn entry() void { |
| 4058 | | // \\ \\ var foo: u32 = @This(){}; |
| 4059 | | // \\ \\} |
| 4060 | | // \\ , &[_][]const u8{ |
| 4061 | | // \\ "tmp.zig:2:27: error: type 'u32' does not support array initialization", |
| 4062 | | // \\ }); |
| 4063 | | // \\ @compileError( |
| 4064 | | // \\ \\ unknown-length pointers and C pointers cannot be hashed deeply. |
| 4065 | | // \\ \\ Consider providing your own hash function. |
| 4066 | | // \\ \\ unknown-length pointers and C pointers cannot be hashed deeply. |
| 4067 | | // \\ \\ Consider providing your own hash function. |
| 4068 | | // \\ ); |
| 4069 | | // \\ return @intCast(i1, doMemCheckClientRequestExpr(0, // default return |
| 4070 | | // \\ .MakeMemUndefined, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0)); |
| 4071 | | // \\} |
| 4072 | | // \\ |
| 4073 | | // \\// This looks like garbage don't do this |
| 4074 | | // \\const rparen = tree.prevToken( |
| 4075 | | // \\// the first token for the annotation expressions is the left |
| 4076 | | // \\// parenthesis, hence the need for two prevToken |
| 4077 | | // \\ if (fn_proto.getAlignExpr()) |align_expr| |
| 4078 | | // \\ tree.prevToken(tree.prevToken(align_expr.firstToken())) |
| 4079 | | // \\else if (fn_proto.getSectionExpr()) |section_expr| |
| 4080 | | // \\ tree.prevToken(tree.prevToken(section_expr.firstToken())) |
| 4081 | | // \\else if (fn_proto.getCallconvExpr()) |callconv_expr| |
| 4082 | | // \\ tree.prevToken(tree.prevToken(callconv_expr.firstToken())) |
| 4083 | | // \\else switch (fn_proto.return_type) { |
| 4084 | | // \\ .Explicit => |node| node.firstToken(), |
| 4085 | | // \\ .InferErrorSet => |node| tree.prevToken(node.firstToken()), |
| 4086 | | // \\ .Invalid => unreachable, |
| 4087 | | // \\}); |
| 4088 | | // \\ |
| 4089 | | // ); |
| 4090 | | //} |
| 4052 | test "zig fmt: use of comments and multiline string literals may force the parameters over multiple lines" { |
| 4053 | try testCanonical( |
| 4054 | \\pub fn makeMemUndefined(qzz: []u8) i1 { |
| 4055 | \\ cases.add( // fixed bug foo |
| 4056 | \\ "compile diagnostic string for top level decl type", |
| 4057 | \\ \\export fn entry() void { |
| 4058 | \\ \\ var foo: u32 = @This(){}; |
| 4059 | \\ \\} |
| 4060 | \\ , &[_][]const u8{ |
| 4061 | \\ "tmp.zig:2:27: error: type 'u32' does not support array initialization", |
| 4062 | \\ }); |
| 4063 | \\ @compileError( |
| 4064 | \\ \\ unknown-length pointers and C pointers cannot be hashed deeply. |
| 4065 | \\ \\ Consider providing your own hash function. |
| 4066 | \\ \\ unknown-length pointers and C pointers cannot be hashed deeply. |
| 4067 | \\ \\ Consider providing your own hash function. |
| 4068 | \\ ); |
| 4069 | \\ return @intCast(i1, doMemCheckClientRequestExpr(0, // default return |
| 4070 | \\ .MakeMemUndefined, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0)); |
| 4071 | \\} |
| 4072 | \\ |
| 4073 | \\// This looks like garbage don't do this |
| 4074 | \\const rparen = tree.prevToken( |
| 4075 | \\// the first token for the annotation expressions is the left |
| 4076 | \\// parenthesis, hence the need for two prevToken |
| 4077 | \\if (fn_proto.getAlignExpr()) |align_expr| |
| 4078 | \\ tree.prevToken(tree.prevToken(align_expr.firstToken())) |
| 4079 | \\else if (fn_proto.getSectionExpr()) |section_expr| |
| 4080 | \\ tree.prevToken(tree.prevToken(section_expr.firstToken())) |
| 4081 | \\else if (fn_proto.getCallconvExpr()) |callconv_expr| |
| 4082 | \\ tree.prevToken(tree.prevToken(callconv_expr.firstToken())) |
| 4083 | \\else switch (fn_proto.return_type) { |
| 4084 | \\ .Explicit => |node| node.firstToken(), |
| 4085 | \\ .InferErrorSet => |node| tree.prevToken(node.firstToken()), |
| 4086 | \\ .Invalid => unreachable, |
| 4087 | \\}); |
| 4088 | \\ |
| 4089 | ); |
| 4090 | } |
| 4091 | 4091 | |
| 4092 | 4092 | test "zig fmt: single argument trailing commas in @builtins()" { |
| 4093 | 4093 | try testCanonical( |