| ... | ... | @@ -18968,22 +18968,23 @@ fn addToInferredErrorSet(sema: *Sema, uncasted_operand: Air.Inst.Ref) !void { |
| 18968 | 18968 | .adhoc_inferred_error_set_type => { |
| 18969 | 18969 | const ies = sema.fn_ret_ty_ies.?; |
| 18970 | 18970 | assert(ies.func == .none); |
| 18971 | | try addToInferredErrorSetPtr(mod, ies, sema.typeOf(uncasted_operand)); |
| 18971 | try sema.addToInferredErrorSetPtr(ies, sema.typeOf(uncasted_operand)); |
| 18972 | 18972 | }, |
| 18973 | 18973 | else => if (ip.isInferredErrorSetType(err_set_ty)) { |
| 18974 | 18974 | const ies = sema.fn_ret_ty_ies.?; |
| 18975 | 18975 | assert(ies.func == sema.func_index); |
| 18976 | | try addToInferredErrorSetPtr(mod, ies, sema.typeOf(uncasted_operand)); |
| 18976 | try sema.addToInferredErrorSetPtr(ies, sema.typeOf(uncasted_operand)); |
| 18977 | 18977 | }, |
| 18978 | 18978 | } |
| 18979 | 18979 | } |
| 18980 | 18980 | |
| 18981 | | fn addToInferredErrorSetPtr(mod: *Module, ies: *InferredErrorSet, op_ty: Type) !void { |
| 18982 | | const gpa = mod.gpa; |
| 18981 | fn addToInferredErrorSetPtr(sema: *Sema, ies: *InferredErrorSet, op_ty: Type) !void { |
| 18982 | const arena = sema.arena; |
| 18983 | const mod = sema.mod; |
| 18983 | 18984 | const ip = &mod.intern_pool; |
| 18984 | 18985 | switch (op_ty.zigTypeTag(mod)) { |
| 18985 | | .ErrorSet => try ies.addErrorSet(op_ty, ip, gpa), |
| 18986 | | .ErrorUnion => try ies.addErrorSet(op_ty.errorUnionSet(mod), ip, gpa), |
| 18986 | .ErrorSet => try ies.addErrorSet(op_ty, ip, arena), |
| 18987 | .ErrorUnion => try ies.addErrorSet(op_ty.errorUnionSet(mod), ip, arena), |
| 18987 | 18988 | else => {}, |
| 18988 | 18989 | } |
| 18989 | 18990 | } |
| ... | ... | @@ -29130,7 +29131,7 @@ fn coerceInMemoryAllowedErrorSets( |
| 29130 | 29131 | // We are trying to coerce an error set to the current function's |
| 29131 | 29132 | // inferred error set. |
| 29132 | 29133 | const dst_ies = sema.fn_ret_ty_ies.?; |
| 29133 | | try dst_ies.addErrorSet(src_ty, ip, gpa); |
| 29134 | try dst_ies.addErrorSet(src_ty, ip, sema.arena); |
| 29134 | 29135 | return .ok; |
| 29135 | 29136 | } |
| 29136 | 29137 | |
| ... | ... | @@ -29140,7 +29141,7 @@ fn coerceInMemoryAllowedErrorSets( |
| 29140 | 29141 | if (dst_ies.func == dst_ies_func_index) { |
| 29141 | 29142 | // We are trying to coerce an error set to the current function's |
| 29142 | 29143 | // inferred error set. |
| 29143 | | try dst_ies.addErrorSet(src_ty, ip, gpa); |
| 29144 | try dst_ies.addErrorSet(src_ty, ip, sema.arena); |
| 29144 | 29145 | return .ok; |
| 29145 | 29146 | } |
| 29146 | 29147 | } |