fix struct and array init when result casted to anyerror!?T

previous commit message is incorrect, it was only for
anyerror!T
This commit is contained in:
Andrew Kelley 2019-06-11 13:44:09 -04:00
parent fc8d881240
commit 1c2e889820
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 8 additions and 3 deletions

View File

@ -1,8 +1,6 @@
Scratch pad for stuff to do before merging master
=================================================
struct & array init when the result is casted to anyerror!?T
uncomment all the behavior tests
look at all the ir_gen_node ir_gen_node_extra calls and make sure result locations are properly propagated

View File

@ -14951,7 +14951,14 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn
if (actual_elem_type->id == ZigTypeIdOptional && implicit_elem_type->id != ZigTypeIdOptional) {
return ir_analyze_unwrap_optional_payload(ira, &instruction->base, result_loc, false, true);
} else if (actual_elem_type->id == ZigTypeIdErrorUnion && implicit_elem_type->id != ZigTypeIdErrorUnion) {
return ir_analyze_unwrap_error_payload(ira, &instruction->base, result_loc, false, true);
IrInstruction *unwrapped_err_ptr = ir_analyze_unwrap_error_payload(ira, &instruction->base,
result_loc, false, true);
ZigType *actual_payload_type = actual_elem_type->data.error_union.payload_type;
if (actual_payload_type->id == ZigTypeIdOptional && implicit_elem_type->id != ZigTypeIdOptional) {
return ir_analyze_unwrap_optional_payload(ira, &instruction->base, unwrapped_err_ptr, false, true);
} else {
return unwrapped_err_ptr;
}
}
return result_loc;
}