| author | |
| committer | |
| log | 4fb39f82c2a5a57b497c741093e95e1e8e1a57fe |
| tree | 0f518551ab70a3f5618420c26b9dc9e3a902dcc2 |
| parent | 40a50f5e2cd4900d2b3d13b353b18a8b6ae052af |
| signature | Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM |
9 files changed, 49 insertions(+), 37 deletions(-)
test/cases/main_return_error_u8.zig created+8| ... | @@ -0,0 +1,8 @@ | ||
| 1 | const Err = error{Foo}; | ||
| 2 | |||
| 3 | pub fn main() !u8 { | ||
| 4 | return Err.Foo; | ||
| 5 | } | ||
| 6 | |||
| 7 | // compile | ||
| 8 | // output_mode=Exe | ||
test/cases/main_return_error_u8_non_zero.zig created+13| ... | @@ -0,0 +1,13 @@ | ||
| 1 | const Err = error{Foo}; | ||
| 2 | |||
| 3 | fn foo() u8 { | ||
| 4 | return @intCast(9); | ||
| 5 | } | ||
| 6 | |||
| 7 | pub fn main() !u8 { | ||
| 8 | if (foo() == 7) return Err.Foo; | ||
| 9 | return 123; | ||
| 10 | } | ||
| 11 | |||
| 12 | // compile | ||
| 13 | // output_mode=Exe | ||
test/cases/noreturn_call_as_arg.zig created+13| ... | @@ -0,0 +1,13 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | fn foo() noreturn { | ||
| 4 | std.process.exit(0); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn bar(_: u8, _: u8) void {} | ||
| 8 | |||
| 9 | pub fn main() void { | ||
| 10 | bar(foo(), @compileError("bad")); | ||
| 11 | } | ||
| 12 | |||
| 13 | // run | ||
test/cases/noreturn_call_inline.zig created+15| ... | @@ -0,0 +1,15 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | _ = bar(); | ||
| 5 | } | ||
| 6 | |||
| 7 | inline fn bar() u8 { | ||
| 8 | noret(); | ||
| 9 | } | ||
| 10 | |||
| 11 | inline fn noret() noreturn { | ||
| 12 | std.process.exit(0); | ||
| 13 | } | ||
| 14 | |||
| 15 | // run | ||
test/standalone/simple/build.zig-4| ... | @@ -105,9 +105,5 @@ const cases = [_]Case{ | ... | @@ -105,9 +105,5 @@ const cases = [_]Case{ |
| 105 | }, | 105 | }, |
| 106 | }, | 106 | }, |
| 107 | .{ .src_path = "guess_number/main.zig" }, | 107 | .{ .src_path = "guess_number/main.zig" }, |
| 108 | .{ .src_path = "main_return_error/error_u8.zig" }, | ||
| 109 | .{ .src_path = "main_return_error/error_u8_non_zero.zig" }, | ||
| 110 | .{ .src_path = "noreturn_call/inline.zig" }, | ||
| 111 | .{ .src_path = "noreturn_call/as_arg.zig" }, | ||
| 112 | .{ .src_path = "std_enums_big_enums.zig" }, | 108 | .{ .src_path = "std_enums_big_enums.zig" }, |
| 113 | }; | 109 | }; |
test/standalone/simple/main_return_error/error_u8.zig deleted-5| ... | @@ -1,5 +0,0 @@ | ||
| 1 | const Err = error{Foo}; | ||
| 2 | |||
| 3 | pub fn main() !u8 { | ||
| 4 | return Err.Foo; | ||
| 5 | } | ||
test/standalone/simple/main_return_error/error_u8_non_zero.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | const Err = error{Foo}; | ||
| 2 | |||
| 3 | fn foo() u8 { | ||
| 4 | return @intCast(9); | ||
| 5 | } | ||
| 6 | |||
| 7 | pub fn main() !u8 { | ||
| 8 | if (foo() == 7) return Err.Foo; | ||
| 9 | return 123; | ||
| 10 | } | ||
test/standalone/simple/noreturn_call/as_arg.zig deleted-8| ... | @@ -1,8 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | fn foo() noreturn { | ||
| 3 | std.process.exit(0); | ||
| 4 | } | ||
| 5 | fn bar(_: u8, _: u8) void {} | ||
| 6 | pub fn main() void { | ||
| 7 | bar(foo(), @compileError("bad")); | ||
| 8 | } | ||
test/standalone/simple/noreturn_call/inline.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | _ = bar(); | ||
| 3 | } | ||
| 4 | inline fn bar() u8 { | ||
| 5 | noret(); | ||
| 6 | } | ||
| 7 | const std = @import("std"); | ||
| 8 | inline fn noret() noreturn { | ||
| 9 | std.process.exit(0); | ||
| 10 | } | ||