Skip to content

Commit f06fb77

Browse files
authored
Revert "[5.0][CSBindings] Detect situations when type variable bindings could be i…"
1 parent 3771246 commit f06fb77

File tree

3 files changed

+2
-32
lines changed

3 files changed

+2
-32
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,6 @@ ConstraintSystem::getPotentialBindings(TypeVariableType *typeVar) {
423423
case ConstraintKind::ArgumentConversion:
424424
case ConstraintKind::OperatorArgumentConversion:
425425
case ConstraintKind::OptionalObject: {
426-
// If there is a `bind param` constraint associated with
427-
// current type variable, result should be aware of that
428-
// fact. Binding set might be incomplete until
429-
// this constraint is resolved, because we currently don't
430-
// look-through constraints expect to `subtype` to try and
431-
// find related bindings.
432-
if (constraint->getKind() == ConstraintKind::BindParam)
433-
result.PotentiallyIncomplete = true;
434-
435426
auto binding = getPotentialBindingForRelationalConstraint(
436427
result, constraint, hasDependentMemberRelationalConstraints,
437428
hasNonDependentMemberRelationalConstraints,

lib/Sema/ConstraintSystem.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,12 +2807,6 @@ class ConstraintSystem {
28072807
/// Whether the bindings of this type involve other type variables.
28082808
bool InvolvesTypeVariables = false;
28092809

2810-
/// Whether the bindings represent (potentially) incomplete set,
2811-
/// there is no way to say with absolute certainty if that's the
2812-
/// case, but that could happen when certain constraints like
2813-
/// `bind param` are present in the system.
2814-
bool PotentiallyIncomplete = false;
2815-
28162810
/// Whether this type variable has literal bindings.
28172811
LiteralBindingKind LiteralBinding = LiteralBindingKind::None;
28182812

@@ -2857,14 +2851,9 @@ class ConstraintSystem {
28572851
if (formBindingScore(y) < formBindingScore(x))
28582852
return false;
28592853

2860-
// If there is a difference in number of default types,
2854+
// If the only difference is default types,
28612855
// prioritize bindings with fewer of them.
2862-
if (x.NumDefaultableBindings != y.NumDefaultableBindings)
2863-
return x.NumDefaultableBindings < y.NumDefaultableBindings;
2864-
2865-
// As a last resort, let's check if the bindings are
2866-
// potentially incomplete, and if so, let's de-prioritize them.
2867-
return x.PotentiallyIncomplete < y.PotentiallyIncomplete;
2856+
return x.NumDefaultableBindings < y.NumDefaultableBindings;
28682857
}
28692858

28702859
void foundLiteralBinding(ProtocolDecl *proto) {
@@ -2897,8 +2886,6 @@ class ConstraintSystem {
28972886
void dump(llvm::raw_ostream &out,
28982887
unsigned indent = 0) const LLVM_ATTRIBUTE_USED {
28992888
out.indent(indent);
2900-
if (PotentiallyIncomplete)
2901-
out << "potentially_incomplete ";
29022889
if (FullyBound)
29032890
out << "fully_bound ";
29042891
if (SubtypeOfExistentialType)

test/Constraints/closures.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -797,11 +797,3 @@ func test<Instances : Collection>(
797797
) { fatalError() }
798798

799799
test([1]) { _, _ in fatalError(); () }
800-
801-
// rdar://problem/45659733
802-
func rdar_45659733() {
803-
func foo<T : BinaryInteger>(_: AnyHashable, _: T) {}
804-
func bar(_ a: Int, _ b: Int) {
805-
_ = (a ..< b).map { i in foo(i, i) } // Ok
806-
}
807-
}

0 commit comments

Comments
 (0)