Skip to content

Commit fb0e084

Browse files
committed
Sema: Sema: Remove isViableForRanking() from determineBestBindings()
1 parent b7e0083 commit fb0e084

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,23 +1141,6 @@ std::optional<BindingSet> ConstraintSystem::determineBestBindings(
11411141
node.initBindingSet();
11421142
}
11431143

1144-
// Determine whether given type variable with its set of bindings is
1145-
// viable to be attempted on the next step of the solver. If type variable
1146-
// has no "direct" bindings of any kind e.g. direct bindings to concrete
1147-
// types, default types from "defaultable" constraints or literal
1148-
// conformances, such type variable is not viable to be evaluated to be
1149-
// attempted next.
1150-
auto isViableForRanking = [this](const BindingSet &bindings) -> bool {
1151-
auto *typeVar = bindings.getTypeVariable();
1152-
1153-
// If type variable is marked as a potential hole there is always going
1154-
// to be at least one binding available for it.
1155-
if (shouldAttemptFixes() && typeVar->getImpl().canBindToHole())
1156-
return true;
1157-
1158-
return bindings.hasViableBindings() || bindings.isDirectHole();
1159-
};
1160-
11611144
// Now let's see if we could infer something for related type
11621145
// variables based on other bindings.
11631146
for (auto *typeVar : getTypeVariables()) {
@@ -1187,15 +1170,11 @@ std::optional<BindingSet> ConstraintSystem::determineBestBindings(
11871170
// associated with given type variable, any default constraints,
11881171
// or any conformance requirements to literal protocols with can
11891172
// produce a default type.
1190-
bool isViable = isViableForRanking(bindings);
1173+
bool isViable = bindings.hasViableBindings() || bindings.isDirectHole();
11911174

11921175
bindings.inferTransitiveSupertypeBindings();
1193-
11941176
bindings.determineLiteralCoverage();
11951177

1196-
if (!bindings.hasViableBindings() && !bindings.isDirectHole())
1197-
continue;
1198-
11991178
if (!isViable)
12001179
continue;
12011180

0 commit comments

Comments
 (0)