sema: inherit block want_safety for err switch union

This commit is contained in:
dweiller 2023-12-30 12:58:35 +11:00
parent 69ab687156
commit ec5b751373
2 changed files with 8 additions and 0 deletions

View File

@ -11292,6 +11292,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp
.runtime_loop = block.runtime_loop,
.runtime_index = block.runtime_index,
.error_return_trace_index = block.error_return_trace_index,
.want_safety = block.want_safety,
};
const merges = &child_block.label.?.merges;
defer child_block.instructions.deinit(gpa);

View File

@ -23,6 +23,13 @@ pub export fn entry() usize {
u += 1;
},
}
if (@as(error{}!usize, u)) |_| {
u += 1;
} else |e| switch (e) {
else => {
u += 1;
}
}
return u;
}