mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 01:24:49 +01:00
Sema: better switch_block_err_union result location if operand has wrong type
also fixes related test case and makes it run everywhere, not just on x86_64-linux!
This commit is contained in:
parent
2e99c3042e
commit
dbfeade221
2 changed files with 2 additions and 3 deletions
|
|
@ -10590,7 +10590,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp
|
|||
break :err_union_ty raw_operand_ty.childType(zcu);
|
||||
};
|
||||
if (err_union_ty.zigTypeTag(zcu) != .error_union) {
|
||||
return sema.fail(block, src, "expected error union type, found '{f}'", .{
|
||||
return sema.fail(block, operand_src, "expected error union type, found '{f}'", .{
|
||||
err_union_ty.fmt(pt),
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,5 @@ pub fn main() void {
|
|||
}
|
||||
|
||||
// error
|
||||
// target=x86_64-linux
|
||||
//
|
||||
// :2:23: error: expected error union type, found 'bool'
|
||||
// :2:11: error: expected error union type, found 'bool'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue