test "error union if" {
var ent_num: error{UnknownEntity}!u32 = error.UnknownEntity;
if (ent_num) |entity| {
try expect(@TypeOf(entity) == u32);
try expect(entity == 5);
} else |err| {
_ = err catch |err1| { // compiles fine when this block is removed
std.debug.print("{s}", .{err1});
};
std.debug.print("{s}", .{err});
}
}
./main.zig:125:5: error: expected error union type, found 'error:124:18'
if (ent_num) |entity| {
^
./main.zig:129:17: note: referenced here
_ = err catch |err1| {