@@ -556,28 +556,15 @@ ConstraintSystem::inferBindingsFor(TypeVariableType *typeVar,
556556 typeVar, ConstraintGraph::GatheringKind::EquivalenceClass);
557557
558558 llvm::SmallPtrSet<CanType, 4 > exactTypes;
559- bool hasNonDependentMemberRelationalConstraints = false ;
560- bool hasDependentMemberRelationalConstraints = false ;
561559
562560 for (auto *constraint : constraints) {
563- bool failed = bindings.infer (*this , exactTypes, constraint,
564- hasNonDependentMemberRelationalConstraints,
565- hasDependentMemberRelationalConstraints);
561+ bool failed = bindings.infer (*this , exactTypes, constraint);
566562
567563 // Upon inference failure let's produce an empty set of bindings.
568564 if (failed)
569565 return {typeVar};
570566 }
571567
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-
581568 if (finalize) {
582569 llvm::SmallDenseMap<TypeVariableType *, ConstraintSystem::PotentialBindings>
583570 inferred;
@@ -590,9 +577,7 @@ ConstraintSystem::inferBindingsFor(TypeVariableType *typeVar,
590577
591578Optional<ConstraintSystem::PotentialBinding>
592579ConstraintSystem::getPotentialBindingForRelationalConstraint (
593- PotentialBindings &result, Constraint *constraint,
594- bool &hasDependentMemberRelationalConstraints,
595- bool &hasNonDependentMemberRelationalConstraints) const {
580+ PotentialBindings &result, Constraint *constraint) const {
596581 assert (constraint->getClassification () ==
597582 ConstraintClassification::Relational &&
598583 " only relational constraints handled here" );
@@ -675,11 +660,11 @@ ConstraintSystem::getPotentialBindingForRelationalConstraint(
675660 if (type->is <DependentMemberType>()) {
676661 if (!ConstraintSystem::typeVarOccursInType (typeVar, type,
677662 &result.InvolvesTypeVariables )) {
678- hasDependentMemberRelationalConstraints = true ;
663+ result. FullyBound = true ;
679664 }
665+
680666 return None;
681667 }
682- hasNonDependentMemberRelationalConstraints = true ;
683668
684669 // If our binding choice is a function type and we're attempting
685670 // to bind to a type variable that is the result of opening a
@@ -751,8 +736,7 @@ ConstraintSystem::getPotentialBindingForRelationalConstraint(
751736// / those types should be opened.
752737bool ConstraintSystem::PotentialBindings::infer (
753738 const ConstraintSystem &cs, llvm::SmallPtrSetImpl<CanType> &exactTypes,
754- Constraint *constraint, bool &hasNonDependentMemberRelationalConstraints,
755- bool &hasDependentMemberRelationalConstraints) {
739+ Constraint *constraint) {
756740 switch (constraint->getKind ()) {
757741 case ConstraintKind::Bind:
758742 case ConstraintKind::Equal:
@@ -777,9 +761,8 @@ bool ConstraintSystem::PotentialBindings::infer(
777761 constraint->getSecondType ()->isEqual (TypeVar))
778762 PotentiallyIncomplete = true ;
779763
780- auto binding = cs.getPotentialBindingForRelationalConstraint (
781- *this , constraint, hasDependentMemberRelationalConstraints,
782- hasNonDependentMemberRelationalConstraints);
764+ auto binding =
765+ cs.getPotentialBindingForRelationalConstraint (*this , constraint);
783766 if (!binding)
784767 break ;
785768
@@ -870,7 +853,6 @@ bool ConstraintSystem::PotentialBindings::infer(
870853 if (cs.getFixedTypeRecursive (constraint->getFirstType (), true )
871854 ->getAs <TypeVariableType>() == TypeVar) {
872855 Defaults.push_back (constraint);
873- hasNonDependentMemberRelationalConstraints = true ;
874856 }
875857 break ;
876858
@@ -904,7 +886,6 @@ bool ConstraintSystem::PotentialBindings::infer(
904886 // Record constraint where protocol requirement originated
905887 // this is useful to use for the binding later.
906888 Protocols.push_back (constraint);
907- hasNonDependentMemberRelationalConstraints = true ;
908889 break ;
909890 }
910891
0 commit comments