@@ -677,7 +677,6 @@ class TypeVariableStep final : public BindingStep<TypeVarBindingProducer> {
677
677
678
678
class DisjunctionStep final : public BindingStep<DisjunctionChoiceProducer> {
679
679
Constraint *Disjunction;
680
- SmallVector<Constraint *, 4 > DisabledChoices;
681
680
ConstraintList::iterator AfterDisjunction;
682
681
683
682
Optional<Score> BestNonGenericScore;
@@ -696,7 +695,6 @@ class DisjunctionStep final : public BindingStep<DisjunctionChoiceProducer> {
696
695
: BindingStep(cs, {cs, disjunction, favoredChoices}, solutions),
697
696
Disjunction (disjunction), AfterDisjunction(erase(disjunction)) {
698
697
assert (Disjunction->getKind () == ConstraintKind::Disjunction);
699
- pruneOverloadSet (Disjunction);
700
698
++cs.solverState ->NumDisjunctions ;
701
699
}
702
700
@@ -705,9 +703,6 @@ class DisjunctionStep final : public BindingStep<DisjunctionChoiceProducer> {
705
703
ActiveChoice.reset ();
706
704
// Return disjunction constraint back to the system.
707
705
restore (AfterDisjunction, Disjunction);
708
- // Re-enable previously disabled overload choices.
709
- for (auto *choice : DisabledChoices)
710
- choice->setEnabled ();
711
706
}
712
707
713
708
StepResult resume (bool prevFailed) override ;
@@ -760,46 +755,6 @@ class DisjunctionStep final : public BindingStep<DisjunctionChoiceProducer> {
760
755
// / simplified further, false otherwise.
761
756
bool attempt (const DisjunctionChoice &choice) override ;
762
757
763
- // Check if selected disjunction has a representative
764
- // this might happen when there are multiple binary operators
765
- // chained together. If so, disable choices which differ
766
- // from currently selected representative.
767
- void pruneOverloadSet (Constraint *disjunction) {
768
- auto *choice = disjunction->getNestedConstraints ().front ();
769
- if (choice->getKind () != ConstraintKind::BindOverload)
770
- return ;
771
-
772
- auto *typeVar = choice->getFirstType ()->getAs <TypeVariableType>();
773
- if (!typeVar)
774
- return ;
775
-
776
- auto *repr = typeVar->getImpl ().getRepresentative (nullptr );
777
- if (!repr || repr == typeVar)
778
- return ;
779
-
780
- for (auto overload : CS.getResolvedOverloads ()) {
781
- auto resolved = overload.second ;
782
- if (!resolved.boundType ->isEqual (repr))
783
- continue ;
784
-
785
- auto &representative = resolved.choice ;
786
- if (!representative.isDecl ())
787
- return ;
788
-
789
- // Disable all of the overload choices which are different from
790
- // the one which is currently picked for representative.
791
- for (auto *constraint : disjunction->getNestedConstraints ()) {
792
- auto choice = constraint->getOverloadChoice ();
793
- if (!choice.isDecl () || choice.getDecl () == representative.getDecl ())
794
- continue ;
795
-
796
- constraint->setDisabled ();
797
- DisabledChoices.push_back (constraint);
798
- }
799
- break ;
800
- }
801
- };
802
-
803
758
// Figure out which of the solutions has the smallest score.
804
759
static Optional<Score> getBestScore (SmallVectorImpl<Solution> &solutions) {
805
760
if (solutions.empty ())
0 commit comments