[Diagnostics] Diagnose ambiguous solutions with warnings like regular ambiguities

If solutions either have no fixes at all or all of the are warnings,
let's use `diagnoseAmbiguity` to diagnose such cases as-if there are
no fixes at all.

Resolves: rdar://79657350
This commit is contained in:
Pavel Yaskevich
2021-07-08 22:05:03 -07:00
parent 191dc14c59
commit d1e12785ed
3 changed files with 37 additions and 2 deletions

View File

@@ -3911,6 +3911,16 @@ bool ConstraintSystem::diagnoseAmbiguityWithFixes(
}
}
// If there either no fixes at all or all of the are warnings,
// let's diagnose this as regular ambiguity.
if (llvm::all_of(solutions, [](const Solution &solution) {
return llvm::all_of(solution.Fixes, [](const ConstraintFix *fix) {
return fix->isWarning();
});
})) {
return diagnoseAmbiguity(solutions);
}
// Algorithm is as follows:
//
// a. Aggregate all of the available fixes based on callee locator;