@@ -3653,22 +3653,6 @@ bool ConstraintSystem::repairFailures(
3653
3653
if (rhs->isAny ())
3654
3654
break ;
3655
3655
3656
- // If there are any other argument mismatches already detected
3657
- // for this call, we can consider overload unrelated.
3658
- if (llvm::any_of (getFixes (), [&](const ConstraintFix *fix) {
3659
- auto *locator = fix->getLocator ();
3660
- // Since arguments to @dynamicCallable form either an array
3661
- // or a dictionary and all have to match the same element type,
3662
- // let's allow multiple invalid arguments.
3663
- if (locator->findFirst <LocatorPathElt::DynamicCallable>())
3664
- return false ;
3665
-
3666
- return locator->findLast <LocatorPathElt::ApplyArgToParam>()
3667
- ? locator->getAnchor () == anchor
3668
- : false ;
3669
- }))
3670
- break ;
3671
-
3672
3656
// If there are any restrictions here we need to wait and let
3673
3657
// `simplifyRestrictedConstraintImpl` handle them.
3674
3658
if (llvm::any_of (conversionsOrFixes,
@@ -9841,7 +9825,20 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
9841
9825
9842
9826
case FixKind::AllowArgumentTypeMismatch: {
9843
9827
increaseScore (SK_Fix);
9844
- return recordFix (fix) ? SolutionKind::Error : SolutionKind::Solved;
9828
+
9829
+ auto impact = 1 ;
9830
+ // If there are any other argument mismatches already detected for this
9831
+ // call, we increase the score even higher so more argument fixes means
9832
+ // less viable is the overload.
9833
+ if (llvm::any_of (getFixes (), [&](const ConstraintFix *fix) {
9834
+ auto *fixLocator = fix->getLocator ();
9835
+ return fixLocator->findLast <LocatorPathElt::ApplyArgToParam>()
9836
+ ? fixLocator->getAnchor () == locator.getAnchor ()
9837
+ : false ;
9838
+ }))
9839
+ impact = 2 ;
9840
+
9841
+ return recordFix (fix, impact) ? SolutionKind::Error : SolutionKind::Solved;
9845
9842
}
9846
9843
9847
9844
case FixKind::ContextualMismatch: {
0 commit comments