Skip to content

Commit ce3b5eb

Browse files
committed
Sema: Bring back BindingSet::operator bool but call it BindingSet::isViable()
1 parent fb0e084 commit ce3b5eb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

include/swift/Sema/CSBindings.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ class BindingSet {
482482
!Defaults.empty();
483483
}
484484

485+
/// Determine whether this set can be chosen as the next binding set
486+
/// to attempt.
487+
bool isViable() const {
488+
return hasViableBindings() || isDirectHole();
489+
}
490+
485491
ArrayRef<Constraint *> getConformanceRequirements() const {
486492
return Protocols;
487493
}

lib/Sema/CSBindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ std::optional<BindingSet> ConstraintSystem::determineBestBindings(
11701170
// associated with given type variable, any default constraints,
11711171
// or any conformance requirements to literal protocols with can
11721172
// produce a default type.
1173-
bool isViable = bindings.hasViableBindings() || bindings.isDirectHole();
1173+
bool isViable = bindings.isViable();
11741174

11751175
bindings.inferTransitiveSupertypeBindings();
11761176
bindings.determineLiteralCoverage();

lib/Sema/ConstraintGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ bool ConstraintGraph::contractEdges() {
922922
if (tyvar1->getImpl().canBindToInOut()) {
923923
bool isNotContractable = true;
924924
auto bindings = CS.getBindingsFor(tyvar1);
925-
if (bindings.hasViableBindings() || bindings.isDirectHole()) {
925+
if (bindings.isViable()) {
926926
// Holes can't be contracted.
927927
if (bindings.isHole())
928928
continue;

0 commit comments

Comments
 (0)