| ... | ... | @@ -2566,8 +2566,19 @@ fn zirMergeErrorSets(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inn |
| 2566 | 2566 | const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node }; |
| 2567 | 2567 | const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node }; |
| 2568 | 2568 | const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node }; |
| 2569 | | const lhs_ty = try sema.resolveType(block, lhs_src, extra.lhs); |
| 2570 | | const rhs_ty = try sema.resolveType(block, rhs_src, extra.rhs); |
| 2569 | const lhs = try sema.resolveInst(extra.lhs); |
| 2570 | const rhs = try sema.resolveInst(extra.rhs); |
| 2571 | if (rhs.ty.zigTypeTag() == .Bool and lhs.ty.zigTypeTag() == .Bool) { |
| 2572 | const msg = msg: { |
| 2573 | const msg = try sema.mod.errMsg(&block.base, lhs_src, "expected error set type, found 'bool'", .{}); |
| 2574 | errdefer msg.destroy(sema.gpa); |
| 2575 | try sema.mod.errNote(&block.base, src, msg, "'||' merges error sets; 'or' performs boolean OR", .{}); |
| 2576 | break :msg msg; |
| 2577 | }; |
| 2578 | return sema.mod.failWithOwnedErrorMsg(&block.base, msg); |
| 2579 | } |
| 2580 | const rhs_ty = try sema.resolveAirAsType(block, rhs_src, rhs); |
| 2581 | const lhs_ty = try sema.resolveAirAsType(block, lhs_src, lhs); |
| 2571 | 2582 | if (rhs_ty.zigTypeTag() != .ErrorSet) |
| 2572 | 2583 | return sema.mod.fail(&block.base, rhs_src, "expected error set type, found {}", .{rhs_ty}); |
| 2573 | 2584 | if (lhs_ty.zigTypeTag() != .ErrorSet) |