@@ -2904,14 +2904,11 @@ bool ConstraintSystem::diagnoseAmbiguityWithFixes(
2904
2904
2905
2905
// Collect aggregated fixes from all solutions
2906
2906
llvm::SmallMapVector<std::pair<ConstraintLocator *, FixKind>,
2907
- llvm::SmallVector<ConstraintFix *, 4 >, 4 > aggregatedFixes;
2908
- for (const auto &solution: solutions) {
2909
- for (auto fixesPerLocator: solution.getAggregatedFixes ()) {
2910
- for (auto kindAndFixes: fixesPerLocator.second ) {
2911
- aggregatedFixes[{fixesPerLocator.first , kindAndFixes.first }]
2912
- .push_back (kindAndFixes.second .front ());
2913
- }
2914
- }
2907
+ llvm::TinyPtrVector<ConstraintFix *>, 4 >
2908
+ aggregatedFixes;
2909
+ for (const auto &solution : solutions) {
2910
+ for (auto *fix : solution.Fixes )
2911
+ aggregatedFixes[{fix->getLocator (), fix->getKind ()}].push_back (fix);
2915
2912
}
2916
2913
2917
2914
// If there is an overload difference, let's see if there's a common callee
@@ -2964,20 +2961,17 @@ bool ConstraintSystem::diagnoseAmbiguityWithFixes(
2964
2961
auto &DE = getASTContext ().Diags ;
2965
2962
auto name = decl->getFullName ();
2966
2963
2967
- if (name.isOperator ()) {
2968
- diagnoseOperatorAmbiguity (*this , name.getBaseIdentifier (), solutions,
2969
- commonCalleeLocator);
2970
- return true ;
2971
- }
2972
-
2973
2964
// Emit an error message for the ambiguity.
2974
2965
if (aggregatedFixes.size () == 1 &&
2975
- aggregatedFixes.front ().first .first
2976
- ->getLastElementAs <LocatorPathElt::ContextualType>()) {
2966
+ aggregatedFixes.front ().first .first ->isForContextualType ()) {
2977
2967
auto *anchor = aggregatedFixes.front ().first .first ->getAnchor ();
2978
2968
auto baseName = name.getBaseName ();
2979
2969
DE.diagnose (commonAnchor->getLoc (), diag::no_candidates_match_result_type,
2980
2970
baseName.userFacingName (), getContextualType (anchor));
2971
+ } else if (name.isOperator ()) {
2972
+ diagnoseOperatorAmbiguity (*this , name.getBaseIdentifier (), solutions,
2973
+ commonCalleeLocator);
2974
+ return true ;
2981
2975
} else {
2982
2976
bool isApplication = llvm::find_if (ArgumentInfos, [&](const auto argInfo) {
2983
2977
return argInfo.first ->getAnchor () == commonAnchor;
0 commit comments