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" {...@@ -442,23 +442,23 @@ test "zig fmt: array types last token" {
442 );442 );
443}443}
444444
445//test "zig fmt: sentinel-terminated array type" {445test "zig fmt: sentinel-terminated array type" {
446// try testCanonical(446 try testCanonical(
447// \\pub fn cStrToPrefixedFileW(s: [*:0]const u8) ![PATH_MAX_WIDE:0]u16 {447 \\pub fn cStrToPrefixedFileW(s: [*:0]const u8) ![PATH_MAX_WIDE:0]u16 {
448// \\ return sliceToPrefixedFileW(mem.toSliceConst(u8, s));448 \\ return sliceToPrefixedFileW(mem.toSliceConst(u8, s));
449// \\}449 \\}
450// \\450 \\
451// );451 );
452//}452}
453//453
454//test "zig fmt: sentinel-terminated slice type" {454test "zig fmt: sentinel-terminated slice type" {
455// try testCanonical(455 try testCanonical(
456// \\pub fn toSlice(self: Buffer) [:0]u8 {456 \\pub fn toSlice(self: Buffer) [:0]u8 {
457// \\ return self.list.toSlice()[0..self.len()];457 \\ return self.list.toSlice()[0..self.len()];
458// \\}458 \\}
459// \\459 \\
460// );460 );
461//}461}
462462
463test "zig fmt: pointer-to-one with modifiers" {463test "zig fmt: pointer-to-one with modifiers" {
464 try testCanonical(464 try testCanonical(
...@@ -2669,28 +2669,28 @@ test "zig fmt: call expression" {...@@ -2669,28 +2669,28 @@ test "zig fmt: call expression" {
2669// \\2669// \\
2670// );2670// );
2671//}2671//}
2672//2672
2673//test "zig fmt: functions" {2673test "zig fmt: functions" {
2674// try testCanonical(2674 try testCanonical(
2675// \\extern fn puts(s: *const u8) c_int;2675 \\extern fn puts(s: *const u8) c_int;
2676// \\extern "c" 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;2677 \\export fn puts(s: *const u8) c_int;
2678// \\fn puts(s: *const u8) callconv(.Inline) c_int;2678 \\fn puts(s: *const u8) callconv(.Inline) c_int;
2679// \\noinline fn puts(s: *const u8) c_int;2679 \\noinline fn puts(s: *const u8) c_int;
2680// \\pub extern 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;2681 \\pub extern "c" fn puts(s: *const u8) c_int;
2682// \\pub export 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;2683 \\pub fn puts(s: *const u8) callconv(.Inline) c_int;
2684// \\pub noinline fn puts(s: *const u8) 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;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;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;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;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;2689 \\pub noinline fn puts(s: *const u8) align(2 + 2) c_int;
2690// \\2690 \\
2691// );2691 );
2692//}2692}
2693//2693
2694//test "zig fmt: multiline string" {2694//test "zig fmt: multiline string" {
2695// try testCanonical(2695// try testCanonical(
2696// \\test "" {2696// \\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...@@ -1250,7 +1250,7 @@ fn renderFnProto(ais: *Ais, tree: ast.Tree, fn_proto: ast.full.FnProto, space: S
1250 const rparen = blk: {1250 const rparen = blk: {
1251 // These may appear in any order, so we have to check the token_starts array1251 // These may appear in any order, so we have to check the token_starts array
1252 // to find out which is first.1252 // 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;
1254 var smallest_start = token_starts[maybe_bang];1254 var smallest_start = token_starts[maybe_bang];
1255 if (fn_proto.ast.align_expr != 0) {1255 if (fn_proto.ast.align_expr != 0) {
1256 const tok = tree.firstToken(fn_proto.ast.align_expr) - 3;1256 const tok = tree.firstToken(fn_proto.ast.align_expr) - 3;