authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-11 13:44:09-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-11 13:44:09-04:00
log1c2e889820e50e26654990750ac5ef0755996618
treea5e6a7e36444a424ed93d5ab58964f7af78d7060
parentfc8d8812404e79716e15fd301058032485e8bb64
signature Commit is signed but in an unrecognized format.

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

previous commit message is incorrect, it was only for anyerror!T

2 files changed, 8 insertions(+), 3 deletions(-)

BRANCH_TODO-2
...@@ -1,8 +1,6 @@...@@ -1,8 +1,6 @@
1Scratch pad for stuff to do before merging master1Scratch pad for stuff to do before merging master
2=================================================2=================================================
33
4struct & array init when the result is casted to anyerror!?T
5
6uncomment all the behavior tests4uncomment all the behavior tests
75
8look at all the ir_gen_node ir_gen_node_extra calls and make sure result locations are properly propagated6look at all the ir_gen_node ir_gen_node_extra calls and make sure result locations are properly propagated
src/ir.cpp+8-1
...@@ -14951,7 +14951,14 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn...@@ -14951,7 +14951,14 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn
14951 if (actual_elem_type->id == ZigTypeIdOptional && implicit_elem_type->id != ZigTypeIdOptional) {14951 if (actual_elem_type->id == ZigTypeIdOptional && implicit_elem_type->id != ZigTypeIdOptional) {
14952 return ir_analyze_unwrap_optional_payload(ira, &instruction->base, result_loc, false, true);14952 return ir_analyze_unwrap_optional_payload(ira, &instruction->base, result_loc, false, true);
14953 } else if (actual_elem_type->id == ZigTypeIdErrorUnion && implicit_elem_type->id != ZigTypeIdErrorUnion) {14953 } else if (actual_elem_type->id == ZigTypeIdErrorUnion && implicit_elem_type->id != ZigTypeIdErrorUnion) {
14954 return ir_analyze_unwrap_error_payload(ira, &instruction->base, result_loc, false, true);14954 IrInstruction *unwrapped_err_ptr = ir_analyze_unwrap_error_payload(ira, &instruction->base,
14955 result_loc, false, true);
14956 ZigType *actual_payload_type = actual_elem_type->data.error_union.payload_type;
14957 if (actual_payload_type->id == ZigTypeIdOptional && implicit_elem_type->id != ZigTypeIdOptional) {
14958 return ir_analyze_unwrap_optional_payload(ira, &instruction->base, unwrapped_err_ptr, false, true);
14959 } else {
14960 return unwrapped_err_ptr;
14961 }
14955 }14962 }
14956 return result_loc;14963 return result_loc;
14957}14964}