IR: unreachable has lowest priority when resolving peer types

This commit is contained in:
Andrew Kelley 2016-12-18 00:25:07 -05:00
parent 9f08bfb38d
commit 83a668b9ca

View File

@ -4248,6 +4248,10 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
TypeTableEntry *prev_type = prev_inst->type_entry; TypeTableEntry *prev_type = prev_inst->type_entry;
if (cur_type->id == TypeTableEntryIdInvalid) { if (cur_type->id == TypeTableEntryIdInvalid) {
return cur_type; return cur_type;
} else if (prev_type->id == TypeTableEntryIdUnreachable) {
prev_inst = cur_inst;
} else if (cur_type->id == TypeTableEntryIdUnreachable) {
continue;
} else if (prev_type->id == TypeTableEntryIdPureError) { } else if (prev_type->id == TypeTableEntryIdPureError) {
prev_inst = cur_inst; prev_inst = cur_inst;
continue; continue;
@ -4265,10 +4269,6 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
} else if (types_match_const_cast_only(cur_type, prev_type)) { } else if (types_match_const_cast_only(cur_type, prev_type)) {
prev_inst = cur_inst; prev_inst = cur_inst;
continue; continue;
} else if (prev_type->id == TypeTableEntryIdUnreachable) {
prev_inst = cur_inst;
} else if (cur_type->id == TypeTableEntryIdUnreachable) {
continue;
} else if (prev_type->id == TypeTableEntryIdInt && } else if (prev_type->id == TypeTableEntryIdInt &&
cur_type->id == TypeTableEntryIdInt && cur_type->id == TypeTableEntryIdInt &&
prev_type->data.integral.is_signed == cur_type->data.integral.is_signed) prev_type->data.integral.is_signed == cur_type->data.integral.is_signed)