mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Bring back BindingSet::operator bool but call it BindingSet::isViable()
This commit is contained in:
@@ -482,6 +482,12 @@ public:
|
||||
!Defaults.empty();
|
||||
}
|
||||
|
||||
/// Determine whether this set can be chosen as the next binding set
|
||||
/// to attempt.
|
||||
bool isViable() const {
|
||||
return hasViableBindings() || isDirectHole();
|
||||
}
|
||||
|
||||
ArrayRef<Constraint *> getConformanceRequirements() const {
|
||||
return Protocols;
|
||||
}
|
||||
|
||||
@@ -1170,7 +1170,7 @@ std::optional<BindingSet> ConstraintSystem::determineBestBindings(
|
||||
// associated with given type variable, any default constraints,
|
||||
// or any conformance requirements to literal protocols with can
|
||||
// produce a default type.
|
||||
bool isViable = bindings.hasViableBindings() || bindings.isDirectHole();
|
||||
bool isViable = bindings.isViable();
|
||||
|
||||
bindings.inferTransitiveSupertypeBindings();
|
||||
bindings.determineLiteralCoverage();
|
||||
|
||||
@@ -922,7 +922,7 @@ bool ConstraintGraph::contractEdges() {
|
||||
if (tyvar1->getImpl().canBindToInOut()) {
|
||||
bool isNotContractable = true;
|
||||
auto bindings = CS.getBindingsFor(tyvar1);
|
||||
if (bindings.hasViableBindings() || bindings.isDirectHole()) {
|
||||
if (bindings.isViable()) {
|
||||
// Holes can't be contracted.
|
||||
if (bindings.isHole())
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user