Skip to content

Commit b407f7c

Browse files
committed
[ConstraintSystem] Avoid recording duplicate fixes for contextual type mismatch
1 parent e2e57ad commit b407f7c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3877,6 +3877,11 @@ bool ConstraintSystem::repairFailures(
38773877
if (lhs->isTypeVariableOrMember() || rhs->isTypeVariableOrMember())
38783878
break;
38793879

3880+
// If there is already a fix for contextual failure, let's not
3881+
// record a duplicate one.
3882+
if (hasFixFor(getConstraintLocator(locator)))
3883+
return true;
3884+
38803885
auto purpose = getContextualTypePurpose(anchor);
38813886
if (rhs->isVoid() &&
38823887
(purpose == CTP_ReturnStmt || purpose == CTP_ReturnSingleExpr)) {

0 commit comments

Comments
 (0)