mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSSimplify] Increase score if conformance constraint finds missing conformances
Although the solver is allowed to use types with missing synthesizable conformances we need to note their presence in the score in order to rank overloads without such types higher.
This commit is contained in:
@@ -8412,6 +8412,16 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
|
||||
if (isConformanceUnavailable(conformance, loc))
|
||||
increaseScore(SK_Unavailable, locator);
|
||||
|
||||
unsigned numMissing = 0;
|
||||
conformance.forEachMissingConformance(DC->getParentModule(),
|
||||
[&numMissing](auto *missing) {
|
||||
++numMissing;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (numMissing > 0)
|
||||
increaseScore(SK_MissingSynthesizableConformance, locator, numMissing);
|
||||
|
||||
// This conformance may be conditional, in which case we need to consider
|
||||
// those requirements as constraints too.
|
||||
if (conformance.isConcrete()) {
|
||||
|
||||
Reference in New Issue
Block a user