[ConstraintSystem] Bind holes to UnresolvedType instead of Any.

This commit is contained in:
Holly Borla
2019-10-10 12:05:58 -07:00
parent 3cdee649f5
commit e63f259f4f
17 changed files with 36 additions and 31 deletions

View File

@@ -2313,7 +2313,7 @@ Type simplifyTypeImpl(const ConstraintSystem &cs, Type type,
});
}
Type ConstraintSystem::simplifyType(Type type) const {
Type ConstraintSystem::simplifyType(Type type, bool forDiagnostics) const {
if (!type->hasTypeVariable())
return type;
@@ -2321,8 +2321,13 @@ Type ConstraintSystem::simplifyType(Type type) const {
return simplifyTypeImpl(
*this, type,
[&](TypeVariableType *tvt) -> Type {
if (auto fixed = getFixedType(tvt))
if (auto fixed = getFixedType(tvt)) {
if (forDiagnostics && fixed->isHole() &&
tvt->getImpl().getLocator()->isForGenericParameter())
return tvt->getImpl().getLocator()->getGenericParameter();
return simplifyType(fixed);
}
return getRepresentative(tvt);
});