zig/test/cases/ir_block_deps.zig
Andrew Kelley d917815d81 explicitly return from blocks
instead of last statement being expression value

closes #629
2017-12-22 00:50:30 -05:00

22 lines
408 B
Zig

const assert = @import("std").debug.assert;
fn foo(id: u64) -> %i32 {
return switch (id) {
1 => getErrInt(),
2 => {
const size = %return getErrInt();
return %return getErrInt();
},
else => error.ItBroke,
};
}
fn getErrInt() -> %i32 { return 0; }
error ItBroke;
test "ir block deps" {
assert(%%foo(1) == 0);
assert(%%foo(2) == 0);
}