diff --git a/src/Sema.zig b/src/Sema.zig index fa066bcd33..29c5c14702 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -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), }); } diff --git a/test/cases/compile_errors/switch_on_non_err_union.zig b/test/cases/compile_errors/switch_on_non_err_union.zig index d505c6d2f1..67eb2035ba 100644 --- a/test/cases/compile_errors/switch_on_non_err_union.zig +++ b/test/cases/compile_errors/switch_on_non_err_union.zig @@ -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'