| ... | ... | @@ -2625,9 +2625,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Com |
| 2625 | 2625 | const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node }; |
| 2626 | 2626 | const lhs = sema.resolveInst(extra.lhs); |
| 2627 | 2627 | const rhs = sema.resolveInst(extra.rhs); |
| 2628 | | const lhs_ty = sema.typeOf(lhs); |
| 2629 | | const rhs_ty = sema.typeOf(rhs); |
| 2630 | | if (rhs_ty.zigTypeTag() == .Bool and lhs_ty.zigTypeTag() == .Bool) { |
| 2628 | if (sema.typeOf(lhs).zigTypeTag() == .Bool and sema.typeOf(rhs).zigTypeTag() == .Bool) { |
| 2631 | 2629 | const msg = msg: { |
| 2632 | 2630 | const msg = try sema.mod.errMsg(&block.base, lhs_src, "expected error set type, found 'bool'", .{}); |
| 2633 | 2631 | errdefer msg.destroy(sema.gpa); |
| ... | ... | @@ -2636,10 +2634,12 @@ fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Com |
| 2636 | 2634 | }; |
| 2637 | 2635 | return sema.mod.failWithOwnedErrorMsg(&block.base, msg); |
| 2638 | 2636 | } |
| 2639 | | if (rhs_ty.zigTypeTag() != .ErrorSet) |
| 2640 | | return sema.mod.fail(&block.base, rhs_src, "expected error set type, found {}", .{rhs_ty}); |
| 2637 | const lhs_ty = try sema.analyzeAsType(block, lhs_src, lhs); |
| 2638 | const rhs_ty = try sema.analyzeAsType(block, rhs_src, rhs); |
| 2641 | 2639 | if (lhs_ty.zigTypeTag() != .ErrorSet) |
| 2642 | 2640 | return sema.mod.fail(&block.base, lhs_src, "expected error set type, found {}", .{lhs_ty}); |
| 2641 | if (rhs_ty.zigTypeTag() != .ErrorSet) |
| 2642 | return sema.mod.fail(&block.base, rhs_src, "expected error set type, found {}", .{rhs_ty}); |
| 2643 | 2643 | |
| 2644 | 2644 | // Anything merged with anyerror is anyerror. |
| 2645 | 2645 | if (lhs_ty.tag() == .anyerror or rhs_ty.tag() == .anyerror) { |