[ConstraintSystem] Avoid recording duplicate fixes for contextual type mismatch

This commit is contained in:
Pavel Yaskevich
2020-06-10 11:43:05 -07:00
parent e2e57ada1b
commit b407f7cd68

View File

@@ -3877,6 +3877,11 @@ bool ConstraintSystem::repairFailures(
if (lhs->isTypeVariableOrMember() || rhs->isTypeVariableOrMember())
break;
// If there is already a fix for contextual failure, let's not
// record a duplicate one.
if (hasFixFor(getConstraintLocator(locator)))
return true;
auto purpose = getContextualTypePurpose(anchor);
if (rhs->isVoid() &&
(purpose == CTP_ReturnStmt || purpose == CTP_ReturnSingleExpr)) {