Skip to content

Commit db2897f

Browse files
committed
Address #18952 review comments
1 parent 9268fcd commit db2897f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/Sema/CSRanking.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,8 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
756756
bool isStdlibOptionalMPlusOperator1 = false;
757757
bool isStdlibOptionalMPlusOperator2 = false;
758758

759-
bool isSwift4ConcreteOverProtocolVar1 = false;
760-
bool isSwift4ConcreteOverProtocolVar2 = false;
759+
bool isVarAndNotProtocol1 = false;
760+
bool isVarAndNotProtocol2 = false;
761761

762762
auto getWeight = [&](ConstraintLocator *locator) -> unsigned {
763763
if (auto *anchor = locator->getAnchor()) {
@@ -986,8 +986,8 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
986986
auto *nominal1 = dc1->getSelfNominalTypeDecl();
987987
auto *nominal2 = dc2->getSelfNominalTypeDecl();
988988
if (nominal1 && nominal2 && nominal1 != nominal2) {
989-
isSwift4ConcreteOverProtocolVar1 = isa<ProtocolDecl>(nominal2);
990-
isSwift4ConcreteOverProtocolVar2 = isa<ProtocolDecl>(nominal1);
989+
isVarAndNotProtocol1 = !isa<ProtocolDecl>(nominal1);
990+
isVarAndNotProtocol2 = !isa<ProtocolDecl>(nominal2);
991991
}
992992
}
993993

@@ -1151,8 +1151,8 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
11511151
// preferring var members in concrete types over a protocol requirement
11521152
// (see the comment above for the rationale of this hack).
11531153
if (!tc.Context.isSwiftVersionAtLeast(5) && score1 == score2) {
1154-
score1 += isSwift4ConcreteOverProtocolVar1;
1155-
score2 += isSwift4ConcreteOverProtocolVar2;
1154+
score1 += isVarAndNotProtocol1;
1155+
score2 += isVarAndNotProtocol2;
11561156
}
11571157

11581158
// FIXME: There are type variables and overloads not common to both solutions

0 commit comments

Comments
 (0)