authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-02-15 13:54:48+01:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-02-15 13:54:48+01:00
logbbf5a4d7c5726baf933e303e6c61c6bba38b694b
tree18f7a8ba3dae19e06a1091cf3aee9c9c8cb63000
parentc2b4d51749c365b1f007df782e06a85c69456937
signaturelock-open Commit is signed but in an unrecognized format.

zig fmt: fix inferred error union return types


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

lib/std/zig/parser_test.zig+39-39
......@@ -442,23 +442,23 @@ test "zig fmt: array types last token" {
442442 );
443443}
444444
445//test "zig fmt: sentinel-terminated array type" {
446// try testCanonical(
447// \\pub fn cStrToPrefixedFileW(s: [*:0]const u8) ![PATH_MAX_WIDE:0]u16 {
448// \\ return sliceToPrefixedFileW(mem.toSliceConst(u8, s));
449// \\}
450// \\
451// );
452//}
453//
454//test "zig fmt: sentinel-terminated slice type" {
455// try testCanonical(
456// \\pub fn toSlice(self: Buffer) [:0]u8 {
457// \\ return self.list.toSlice()[0..self.len()];
458// \\}
459// \\
460// );
461//}
445test "zig fmt: sentinel-terminated array type" {
446 try testCanonical(
447 \\pub fn cStrToPrefixedFileW(s: [*:0]const u8) ![PATH_MAX_WIDE:0]u16 {
448 \\ return sliceToPrefixedFileW(mem.toSliceConst(u8, s));
449 \\}
450 \\
451 );
452}
453
454test "zig fmt: sentinel-terminated slice type" {
455 try testCanonical(
456 \\pub fn toSlice(self: Buffer) [:0]u8 {
457 \\ return self.list.toSlice()[0..self.len()];
458 \\}
459 \\
460 );
461}
462462
463463test "zig fmt: pointer-to-one with modifiers" {
464464 try testCanonical(
......@@ -2669,28 +2669,28 @@ test "zig fmt: call expression" {
26692669// \\
26702670// );
26712671//}
2672//
2673//test "zig fmt: functions" {
2674// try testCanonical(
2675// \\extern fn puts(s: *const u8) c_int;
2676// \\extern "c" fn puts(s: *const u8) c_int;
2677// \\export fn puts(s: *const u8) c_int;
2678// \\fn puts(s: *const u8) callconv(.Inline) c_int;
2679// \\noinline fn puts(s: *const u8) c_int;
2680// \\pub extern fn puts(s: *const u8) c_int;
2681// \\pub extern "c" fn puts(s: *const u8) c_int;
2682// \\pub export fn puts(s: *const u8) c_int;
2683// \\pub fn puts(s: *const u8) callconv(.Inline) c_int;
2684// \\pub noinline fn puts(s: *const u8) c_int;
2685// \\pub extern fn puts(s: *const u8) align(2 + 2) c_int;
2686// \\pub extern "c" fn puts(s: *const u8) align(2 + 2) c_int;
2687// \\pub export fn puts(s: *const u8) align(2 + 2) c_int;
2688// \\pub fn puts(s: *const u8) align(2 + 2) callconv(.Inline) c_int;
2689// \\pub noinline fn puts(s: *const u8) align(2 + 2) c_int;
2690// \\
2691// );
2692//}
2693//
2672
2673test "zig fmt: functions" {
2674 try testCanonical(
2675 \\extern fn puts(s: *const u8) c_int;
2676 \\extern "c" fn puts(s: *const u8) c_int;
2677 \\export fn puts(s: *const u8) c_int;
2678 \\fn puts(s: *const u8) callconv(.Inline) c_int;
2679 \\noinline fn puts(s: *const u8) c_int;
2680 \\pub extern fn puts(s: *const u8) c_int;
2681 \\pub extern "c" fn puts(s: *const u8) c_int;
2682 \\pub export fn puts(s: *const u8) c_int;
2683 \\pub fn puts(s: *const u8) callconv(.Inline) c_int;
2684 \\pub noinline fn puts(s: *const u8) c_int;
2685 \\pub extern fn puts(s: *const u8) align(2 + 2) c_int;
2686 \\pub extern "c" fn puts(s: *const u8) align(2 + 2) c_int;
2687 \\pub export fn puts(s: *const u8) align(2 + 2) c_int;
2688 \\pub fn puts(s: *const u8) align(2 + 2) callconv(.Inline) c_int;
2689 \\pub noinline fn puts(s: *const u8) align(2 + 2) c_int;
2690 \\
2691 );
2692}
2693
26942694//test "zig fmt: multiline string" {
26952695// try testCanonical(
26962696// \\test "" {
lib/std/zig/render.zig+1-1
......@@ -1250,7 +1250,7 @@ fn renderFnProto(ais: *Ais, tree: ast.Tree, fn_proto: ast.full.FnProto, space: S
12501250 const rparen = blk: {
12511251 // These may appear in any order, so we have to check the token_starts array
12521252 // to find out which is first.
1253 var rparen: ast.TokenIndex = maybe_bang;
1253 var rparen = if (token_tags[maybe_bang] == .bang) maybe_bang - 1 else maybe_bang;
12541254 var smallest_start = token_starts[maybe_bang];
12551255 if (fn_proto.ast.align_expr != 0) {
12561256 const tok = tree.firstToken(fn_proto.ast.align_expr) - 3;