| ... | @@ -22469,17 +22469,7 @@ static IrInstruction *ir_analyze_instruction_result_ptr(IrAnalyze *ira, IrInstru | ... | @@ -22469,17 +22469,7 @@ static IrInstruction *ir_analyze_instruction_result_ptr(IrAnalyze *ira, IrInstru |
| 22469 | if (instruction->result_loc->written && instruction->result_loc->resolved_loc != nullptr && | 22469 | if (instruction->result_loc->written && instruction->result_loc->resolved_loc != nullptr && |
| 22470 | !instr_is_comptime(result)) | 22470 | !instr_is_comptime(result)) |
| 22471 | { | 22471 | { |
| 22472 | IrInstruction *result_ptr = instruction->result_loc->resolved_loc; | 22472 | return instruction->result_loc->resolved_loc; |
| 22473 | if (result->value.type->id == ZigTypeIdErrorUnion && | | |
| 22474 | result_ptr->value.type->data.pointer.child_type->id == ZigTypeIdErrorUnion) | | |
| 22475 | { | | |
| 22476 | // Convert the pointer to the result type. They should be the same, except this will resolve | | |
| 22477 | // inferred error sets. | | |
| 22478 | ZigType *new_ptr_type = get_pointer_to_type(ira->codegen, result->value.type, true); | | |
| 22479 | return ir_analyze_ptr_cast(ira, &instruction->base, result_ptr, new_ptr_type, &instruction->base, false); | | |
| 22480 | } else { | | |
| 22481 | return result_ptr; | | |
| 22482 | } | | |
| 22483 | } | 22473 | } |
| 22484 | return ir_get_ref(ira, &instruction->base, result, true, false); | 22474 | return ir_get_ref(ira, &instruction->base, result, true, false); |
| 22485 | } | 22475 | } |
| ... | @@ -22506,17 +22496,6 @@ static IrInstruction *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruct | ... | @@ -22506,17 +22496,6 @@ static IrInstruction *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstruct |
| 22506 | } | 22496 | } |
| 22507 | } | 22497 | } |
| 22508 | | 22498 | |
| 22509 | ZigType *err_set_type = type_entry->data.error_union.err_set_type; | | |
| 22510 | if (!resolve_inferred_error_set(ira->codegen, err_set_type, instruction->base.source_node)) { | | |
| 22511 | return ira->codegen->invalid_instruction; | | |
| 22512 | } | | |
| 22513 | if (!type_is_global_error_set(err_set_type) && | | |
| 22514 | err_set_type->data.error_set.err_count == 0) | | |
| 22515 | { | | |
| 22516 | assert(err_set_type->data.error_set.infer_fn == nullptr); | | |
| 22517 | return ir_const_bool(ira, &instruction->base, false); | | |
| 22518 | } | | |
| 22519 | | | |
| 22520 | return ir_build_test_err_gen(ira, &instruction->base, value); | 22499 | return ir_build_test_err_gen(ira, &instruction->base, value); |
| 22521 | } else if (type_entry->id == ZigTypeIdErrorSet) { | 22500 | } else if (type_entry->id == ZigTypeIdErrorSet) { |
| 22522 | return ir_const_bool(ira, &instruction->base, true); | 22501 | return ir_const_bool(ira, &instruction->base, true); |