Move another chunk of lvalue diagnostics over to being handled via ConstraintFix.

This commit is contained in:
gregomni
2018-08-19 13:14:55 -07:00
parent aeb96274d2
commit 19fce5d36f
5 changed files with 80 additions and 72 deletions

View File

@@ -2450,6 +2450,11 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
TreatRValueAsLValue::create(*this, getConstraintLocator(locator)));
}
}
if (type2->is<LValueType>() && !isTypeVarOrMember1) {
conversionsOrFixes.push_back(
TreatRValueAsLValue::create(*this, getConstraintLocator(locator)));
}
}
if (conversionsOrFixes.empty()) {
@@ -4659,11 +4664,11 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
addContextualScore();
// Unwrap an inout type.
auto obj1 = type1->getInOutObjectType();
obj1 = getFixedTypeRecursive(obj1, false, false);
auto t2 = type2->getDesugaredType();
auto baseType1 = getFixedTypeRecursive(*isArrayType(obj1), false, false);
auto baseType2 = getBaseTypeForPointer(*this, t2);