@@ -2763,14 +2763,21 @@ static bool diagnoseConflictingGenericArguments(ConstraintSystem &cs,
2763
2763
if (!diff.overloads .empty ())
2764
2764
return false ;
2765
2765
2766
- if (!llvm::all_of (solutions, [](const Solution &solution) -> bool {
2766
+ bool noFixes = llvm::all_of (solutions, [](const Solution &solution) -> bool {
2767
+ return solution.Fixes .empty ();
2768
+ });
2769
+
2770
+ bool allMismatches =
2771
+ llvm::all_of (solutions, [](const Solution &solution) -> bool {
2767
2772
return llvm::all_of (
2768
2773
solution.Fixes , [](const ConstraintFix *fix) -> bool {
2769
2774
return fix->getKind () == FixKind::AllowArgumentTypeMismatch ||
2770
2775
fix->getKind () == FixKind::AllowFunctionTypeMismatch ||
2771
2776
fix->getKind () == FixKind::AllowTupleTypeMismatch;
2772
2777
});
2773
- }))
2778
+ });
2779
+
2780
+ if (!noFixes && !allMismatches)
2774
2781
return false ;
2775
2782
2776
2783
auto &DE = cs.getASTContext ().Diags ;
@@ -2923,6 +2930,11 @@ bool ConstraintSystem::diagnoseAmbiguityWithFixes(
2923
2930
if (solutions.empty ())
2924
2931
return false ;
2925
2932
2933
+ SolutionDiff solutionDiff (solutions);
2934
+
2935
+ if (diagnoseConflictingGenericArguments (*this , solutionDiff, solutions))
2936
+ return true ;
2937
+
2926
2938
if (auto bestScore = solverState->BestScore ) {
2927
2939
solutions.erase (llvm::remove_if (solutions,
2928
2940
[&](const Solution &solution) {
@@ -2938,11 +2950,6 @@ bool ConstraintSystem::diagnoseAmbiguityWithFixes(
2938
2950
return false ;
2939
2951
}
2940
2952
2941
- SolutionDiff solutionDiff (solutions);
2942
-
2943
- if (diagnoseConflictingGenericArguments (*this , solutionDiff, solutions))
2944
- return true ;
2945
-
2946
2953
if (diagnoseAmbiguityWithEphemeralPointers (*this , solutions))
2947
2954
return true ;
2948
2955
0 commit comments