| ... | @@ -9344,9 +9344,15 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT | ... | @@ -9344,9 +9344,15 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT |
| 9344 | if (prev_inst->value.type->id == ZigTypeIdErrorSet) { | 9344 | if (prev_inst->value.type->id == ZigTypeIdErrorSet) { |
| 9345 | return err_set_type; | 9345 | return err_set_type; |
| 9346 | } else if (prev_inst->value.type->id == ZigTypeIdErrorUnion) { | 9346 | } else if (prev_inst->value.type->id == ZigTypeIdErrorUnion) { |
| 9347 | return get_error_union_type(ira->codegen, err_set_type, prev_inst->value.type->data.error_union.payload_type); | 9347 | ZigType *payload_type = prev_inst->value.type->data.error_union.payload_type; |
| | 9348 | if ((err = type_resolve(ira->codegen, payload_type, ResolveStatusSizeKnown))) |
| | 9349 | return ira->codegen->builtin_types.entry_invalid; |
| | 9350 | return get_error_union_type(ira->codegen, err_set_type, payload_type); |
| 9348 | } else if (expected_type != nullptr && expected_type->id == ZigTypeIdErrorUnion) { | 9351 | } else if (expected_type != nullptr && expected_type->id == ZigTypeIdErrorUnion) { |
| 9349 | return get_error_union_type(ira->codegen, err_set_type, expected_type->data.error_union.payload_type); | 9352 | ZigType *payload_type = expected_type->data.error_union.payload_type; |
| | 9353 | if ((err = type_resolve(ira->codegen, payload_type, ResolveStatusSizeKnown))) |
| | 9354 | return ira->codegen->builtin_types.entry_invalid; |
| | 9355 | return get_error_union_type(ira->codegen, err_set_type, payload_type); |
| 9350 | } else { | 9356 | } else { |
| 9351 | if (prev_inst->value.type->id == ZigTypeIdComptimeInt || | 9357 | if (prev_inst->value.type->id == ZigTypeIdComptimeInt || |
| 9352 | prev_inst->value.type->id == ZigTypeIdComptimeFloat) | 9358 | prev_inst->value.type->id == ZigTypeIdComptimeFloat) |
| ... | @@ -9359,6 +9365,8 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT | ... | @@ -9359,6 +9365,8 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT |
| 9359 | buf_sprintf("unable to make error union out of null literal")); | 9365 | buf_sprintf("unable to make error union out of null literal")); |
| 9360 | return ira->codegen->builtin_types.entry_invalid; | 9366 | return ira->codegen->builtin_types.entry_invalid; |
| 9361 | } else { | 9367 | } else { |
| | 9368 | if ((err = type_resolve(ira->codegen, prev_inst->value.type, ResolveStatusSizeKnown))) |
| | 9369 | return ira->codegen->builtin_types.entry_invalid; |
| 9362 | return get_error_union_type(ira->codegen, err_set_type, prev_inst->value.type); | 9370 | return get_error_union_type(ira->codegen, err_set_type, prev_inst->value.type); |
| 9363 | } | 9371 | } |
| 9364 | } | 9372 | } |
| ... | @@ -13053,6 +13061,8 @@ static ZigType *ir_analyze_instruction_error_return_trace(IrAnalyze *ira, | ... | @@ -13053,6 +13061,8 @@ static ZigType *ir_analyze_instruction_error_return_trace(IrAnalyze *ira, |
| 13053 | static ZigType *ir_analyze_instruction_error_union(IrAnalyze *ira, | 13061 | static ZigType *ir_analyze_instruction_error_union(IrAnalyze *ira, |
| 13054 | IrInstructionErrorUnion *instruction) | 13062 | IrInstructionErrorUnion *instruction) |
| 13055 | { | 13063 | { |
| | 13064 | Error err; |
| | 13065 | |
| 13056 | ZigType *err_set_type = ir_resolve_type(ira, instruction->err_set->other); | 13066 | ZigType *err_set_type = ir_resolve_type(ira, instruction->err_set->other); |
| 13057 | if (type_is_invalid(err_set_type)) | 13067 | if (type_is_invalid(err_set_type)) |
| 13058 | return ira->codegen->builtin_types.entry_invalid; | 13068 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -13068,6 +13078,8 @@ static ZigType *ir_analyze_instruction_error_union(IrAnalyze *ira, | ... | @@ -13068,6 +13078,8 @@ static ZigType *ir_analyze_instruction_error_union(IrAnalyze *ira, |
| 13068 | return ira->codegen->builtin_types.entry_invalid; | 13078 | return ira->codegen->builtin_types.entry_invalid; |
| 13069 | } | 13079 | } |
| 13070 | | 13080 | |
| | 13081 | if ((err = type_resolve(ira->codegen, payload_type, ResolveStatusSizeKnown))) |
| | 13082 | return ira->codegen->builtin_types.entry_invalid; |
| 13071 | ZigType *result_type = get_error_union_type(ira->codegen, err_set_type, payload_type); | 13083 | ZigType *result_type = get_error_union_type(ira->codegen, err_set_type, payload_type); |
| 13072 | | 13084 | |
| 13073 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 13085 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| ... | @@ -13486,6 +13498,8 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr | ... | @@ -13486,6 +13498,8 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr |
| 13486 | ZigType *inferred_err_set_type = nullptr; | 13498 | ZigType *inferred_err_set_type = nullptr; |
| 13487 | if (fn_proto_node->data.fn_proto.auto_err_set) { | 13499 | if (fn_proto_node->data.fn_proto.auto_err_set) { |
| 13488 | inferred_err_set_type = get_auto_err_set_type(ira->codegen, fn_entry); | 13500 | inferred_err_set_type = get_auto_err_set_type(ira->codegen, fn_entry); |
| | 13501 | if ((err = type_resolve(ira->codegen, specified_return_type, ResolveStatusSizeKnown))) |
| | 13502 | return ira->codegen->builtin_types.entry_invalid; |
| 13489 | return_type = get_error_union_type(ira->codegen, inferred_err_set_type, specified_return_type); | 13503 | return_type = get_error_union_type(ira->codegen, inferred_err_set_type, specified_return_type); |
| 13490 | } else { | 13504 | } else { |
| 13491 | return_type = specified_return_type; | 13505 | return_type = specified_return_type; |
| ... | @@ -13713,6 +13727,8 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr | ... | @@ -13713,6 +13727,8 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr |
| 13713 | return ira->codegen->builtin_types.entry_invalid; | 13727 | return ira->codegen->builtin_types.entry_invalid; |
| 13714 | if (fn_proto_node->data.fn_proto.auto_err_set) { | 13728 | if (fn_proto_node->data.fn_proto.auto_err_set) { |
| 13715 | ZigType *inferred_err_set_type = get_auto_err_set_type(ira->codegen, impl_fn); | 13729 | ZigType *inferred_err_set_type = get_auto_err_set_type(ira->codegen, impl_fn); |
| | 13730 | if ((err = type_resolve(ira->codegen, specified_return_type, ResolveStatusSizeKnown))) |
| | 13731 | return ira->codegen->builtin_types.entry_invalid; |
| 13716 | inst_fn_type_id.return_type = get_error_union_type(ira->codegen, inferred_err_set_type, specified_return_type); | 13732 | inst_fn_type_id.return_type = get_error_union_type(ira->codegen, inferred_err_set_type, specified_return_type); |
| 13717 | } else { | 13733 | } else { |
| 13718 | inst_fn_type_id.return_type = specified_return_type; | 13734 | inst_fn_type_id.return_type = specified_return_type; |