Fix peer type resolution

This commit is contained in:
Noam Preil
2020-10-07 02:31:47 -04:00
parent 7b88215a49
commit de093879cc
2 changed files with 53 additions and 1 deletions

View File

@@ -2661,11 +2661,15 @@ pub fn resolvePeerTypes(self: *Module, scope: *Scope, instructions: []*Inst) !Ty
continue;
}
if ((prev_inst.ty.zigTypeTag() == .ComptimeInt and next_inst.ty.isInt()) or (next_inst.ty.zigTypeTag() == .ComptimeInt and prev_inst.ty.isInt())) {
if (prev_inst.ty.zigTypeTag() == .ComptimeInt and next_inst.ty.isInt()) {
prev_inst = next_inst;
continue;
}
if (prev_inst.ty.isInt() and next_inst.ty.zigTypeTag() == .ComptimeInt) {
continue;
}
// TODO error notes pointing out each type
return self.fail(scope, next_inst.src, "incompatible types: '{}' and '{}'", .{ prev_inst.ty, next_inst.ty });
}