| ... | @@ -10093,9 +10093,21 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT | ... | @@ -10093,9 +10093,21 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT |
| 10093 | { | 10093 | { |
| 10094 | Error err; | 10094 | Error err; |
| 10095 | assert(instruction_count >= 1); | 10095 | assert(instruction_count >= 1); |
| 10096 | IrInstruction *prev_inst = instructions[0]; | 10096 | IrInstruction *prev_inst; |
| 10097 | if (type_is_invalid(prev_inst->value.type)) { | 10097 | size_t i = 0; |
| 10098 | return ira->codegen->builtin_types.entry_invalid; | 10098 | for (;;) { |
| | 10099 | prev_inst = instructions[i]; |
| | 10100 | if (type_is_invalid(prev_inst->value.type)) { |
| | 10101 | return ira->codegen->builtin_types.entry_invalid; |
| | 10102 | } |
| | 10103 | if (prev_inst->value.type->id == ZigTypeIdUnreachable) { |
| | 10104 | i += 1; |
| | 10105 | if (i == instruction_count) { |
| | 10106 | return prev_inst->value.type; |
| | 10107 | } |
| | 10108 | continue; |
| | 10109 | } |
| | 10110 | break; |
| 10099 | } | 10111 | } |
| 10100 | ErrorTableEntry **errors = nullptr; | 10112 | ErrorTableEntry **errors = nullptr; |
| 10101 | size_t errors_count = 0; | 10113 | size_t errors_count = 0; |
| ... | @@ -10120,7 +10132,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT | ... | @@ -10120,7 +10132,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT |
| 10120 | | 10132 | |
| 10121 | bool any_are_null = (prev_inst->value.type->id == ZigTypeIdNull); | 10133 | bool any_are_null = (prev_inst->value.type->id == ZigTypeIdNull); |
| 10122 | bool convert_to_const_slice = false; | 10134 | bool convert_to_const_slice = false; |
| 10123 | for (size_t i = 1; i < instruction_count; i += 1) { | 10135 | for (; i < instruction_count; i += 1) { |
| 10124 | IrInstruction *cur_inst = instructions[i]; | 10136 | IrInstruction *cur_inst = instructions[i]; |
| 10125 | ZigType *cur_type = cur_inst->value.type; | 10137 | ZigType *cur_type = cur_inst->value.type; |
| 10126 | ZigType *prev_type = prev_inst->value.type; | 10138 | ZigType *prev_type = prev_inst->value.type; |
| ... | @@ -10139,7 +10151,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT | ... | @@ -10139,7 +10151,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT |
| 10139 | } | 10151 | } |
| 10140 | | 10152 | |
| 10141 | if (prev_type->id == ZigTypeIdErrorSet) { | 10153 | if (prev_type->id == ZigTypeIdErrorSet) { |
| 10142 | assert(err_set_type != nullptr); | 10154 | ir_assert(err_set_type != nullptr, prev_inst); |
| 10143 | if (cur_type->id == ZigTypeIdErrorSet) { | 10155 | if (cur_type->id == ZigTypeIdErrorSet) { |
| 10144 | if (type_is_global_error_set(err_set_type)) { | 10156 | if (type_is_global_error_set(err_set_type)) { |
| 10145 | continue; | 10157 | continue; |