@@ -556,28 +556,15 @@ ConstraintSystem::inferBindingsFor(TypeVariableType *typeVar,
556
556
typeVar, ConstraintGraph::GatheringKind::EquivalenceClass);
557
557
558
558
llvm::SmallPtrSet<CanType, 4 > exactTypes;
559
- bool hasNonDependentMemberRelationalConstraints = false ;
560
- bool hasDependentMemberRelationalConstraints = false ;
561
559
562
560
for (auto *constraint : constraints) {
563
- bool failed = bindings.infer (*this , exactTypes, constraint,
564
- hasNonDependentMemberRelationalConstraints,
565
- hasDependentMemberRelationalConstraints);
561
+ bool failed = bindings.infer (*this , exactTypes, constraint);
566
562
567
563
// Upon inference failure let's produce an empty set of bindings.
568
564
if (failed)
569
565
return {typeVar};
570
566
}
571
567
572
- // If there were both dependent-member and non-dependent-member relational
573
- // constraints, consider this "fully bound"; we don't want to touch it.
574
- if (hasDependentMemberRelationalConstraints) {
575
- if (hasNonDependentMemberRelationalConstraints)
576
- bindings.FullyBound = true ;
577
- else
578
- bindings.Bindings .clear ();
579
- }
580
-
581
568
if (finalize) {
582
569
llvm::SmallDenseMap<TypeVariableType *, ConstraintSystem::PotentialBindings>
583
570
inferred;
@@ -590,9 +577,7 @@ ConstraintSystem::inferBindingsFor(TypeVariableType *typeVar,
590
577
591
578
Optional<ConstraintSystem::PotentialBinding>
592
579
ConstraintSystem::getPotentialBindingForRelationalConstraint (
593
- PotentialBindings &result, Constraint *constraint,
594
- bool &hasDependentMemberRelationalConstraints,
595
- bool &hasNonDependentMemberRelationalConstraints) const {
580
+ PotentialBindings &result, Constraint *constraint) const {
596
581
assert (constraint->getClassification () ==
597
582
ConstraintClassification::Relational &&
598
583
" only relational constraints handled here" );
@@ -675,11 +660,11 @@ ConstraintSystem::getPotentialBindingForRelationalConstraint(
675
660
if (type->is <DependentMemberType>()) {
676
661
if (!ConstraintSystem::typeVarOccursInType (typeVar, type,
677
662
&result.InvolvesTypeVariables )) {
678
- hasDependentMemberRelationalConstraints = true ;
663
+ result. FullyBound = true ;
679
664
}
665
+
680
666
return None;
681
667
}
682
- hasNonDependentMemberRelationalConstraints = true ;
683
668
684
669
// If our binding choice is a function type and we're attempting
685
670
// to bind to a type variable that is the result of opening a
@@ -751,8 +736,7 @@ ConstraintSystem::getPotentialBindingForRelationalConstraint(
751
736
// / those types should be opened.
752
737
bool ConstraintSystem::PotentialBindings::infer (
753
738
const ConstraintSystem &cs, llvm::SmallPtrSetImpl<CanType> &exactTypes,
754
- Constraint *constraint, bool &hasNonDependentMemberRelationalConstraints,
755
- bool &hasDependentMemberRelationalConstraints) {
739
+ Constraint *constraint) {
756
740
switch (constraint->getKind ()) {
757
741
case ConstraintKind::Bind:
758
742
case ConstraintKind::Equal:
@@ -777,9 +761,8 @@ bool ConstraintSystem::PotentialBindings::infer(
777
761
constraint->getSecondType ()->isEqual (TypeVar))
778
762
PotentiallyIncomplete = true ;
779
763
780
- auto binding = cs.getPotentialBindingForRelationalConstraint (
781
- *this , constraint, hasDependentMemberRelationalConstraints,
782
- hasNonDependentMemberRelationalConstraints);
764
+ auto binding =
765
+ cs.getPotentialBindingForRelationalConstraint (*this , constraint);
783
766
if (!binding)
784
767
break ;
785
768
@@ -870,7 +853,6 @@ bool ConstraintSystem::PotentialBindings::infer(
870
853
if (cs.getFixedTypeRecursive (constraint->getFirstType (), true )
871
854
->getAs <TypeVariableType>() == TypeVar) {
872
855
Defaults.push_back (constraint);
873
- hasNonDependentMemberRelationalConstraints = true ;
874
856
}
875
857
break ;
876
858
@@ -904,7 +886,6 @@ bool ConstraintSystem::PotentialBindings::infer(
904
886
// Record constraint where protocol requirement originated
905
887
// this is useful to use for the binding later.
906
888
Protocols.push_back (constraint);
907
- hasNonDependentMemberRelationalConstraints = true ;
908
889
break ;
909
890
}
910
891
0 commit comments