| 1 | const builtin = @import("builtin"); |
| 2 | const expect = @import("std").testing.expect; |
| 3 | |
| 4 | fn foo(id: u64) !i32 { |
| 5 | return switch (id) { |
| 6 | 1 => getErrInt(), |
| 7 | 2 => { |
| 8 | const size = try getErrInt(); |
| 9 | _ = size; |
| 10 | return try getErrInt(); |
| 11 | }, |
| 12 | else => error.ItBroke, |
| 13 | }; |
| 14 | } |
| 15 | |
| 16 | fn getErrInt() anyerror!i32 { |
| 17 | return 0; |
| 18 | } |
| 19 | |
| 20 | test "ir block deps" { |
| 21 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 22 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 23 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 24 | |
| 25 | try expect((foo(1) catch unreachable) == 0); |
| 26 | try expect((foo(2) catch unreachable) == 0); |
| 27 | } |