@@ -671,8 +671,6 @@ class TypeVariableStep final : public BindingStep<TypeVarBindingProducer> {
671
671
672
672
class DisjunctionStep final : public BindingStep<DisjunctionChoiceProducer> {
673
673
Constraint *Disjunction;
674
- SmallVector<Constraint *, 4 > DisabledChoices;
675
-
676
674
std::optional<Score> BestNonGenericScore;
677
675
std::optional<std::pair<Constraint *, Score>> LastSolvedChoice;
678
676
@@ -689,16 +687,12 @@ class DisjunctionStep final : public BindingStep<DisjunctionChoiceProducer> {
689
687
: BindingStep(cs, {cs, disjunction, favoredChoices}, solutions),
690
688
Disjunction (disjunction) {
691
689
assert (Disjunction->getKind () == ConstraintKind::Disjunction);
692
- pruneOverloadSet (Disjunction);
693
690
++cs.solverState ->NumDisjunctions ;
694
691
}
695
692
696
693
~DisjunctionStep () override {
697
694
// Rewind back any changes left after attempting last choice.
698
695
ActiveChoice.reset ();
699
- // Re-enable previously disabled overload choices.
700
- for (auto *choice : DisabledChoices)
701
- choice->setEnabled ();
702
696
}
703
697
704
698
StepResult resume (bool prevFailed) override ;
@@ -751,46 +745,6 @@ class DisjunctionStep final : public BindingStep<DisjunctionChoiceProducer> {
751
745
// / simplified further, false otherwise.
752
746
bool attempt (const DisjunctionChoice &choice) override ;
753
747
754
- // Check if selected disjunction has a representative
755
- // this might happen when there are multiple binary operators
756
- // chained together. If so, disable choices which differ
757
- // from currently selected representative.
758
- void pruneOverloadSet (Constraint *disjunction) {
759
- auto *choice = disjunction->getNestedConstraints ().front ();
760
- if (choice->getKind () != ConstraintKind::BindOverload)
761
- return ;
762
-
763
- auto *typeVar = choice->getFirstType ()->getAs <TypeVariableType>();
764
- if (!typeVar)
765
- return ;
766
-
767
- auto *repr = typeVar->getImpl ().getRepresentative (nullptr );
768
- if (!repr || repr == typeVar)
769
- return ;
770
-
771
- for (auto overload : CS.getResolvedOverloads ()) {
772
- auto resolved = overload.second ;
773
- if (!resolved.boundType ->isEqual (repr))
774
- continue ;
775
-
776
- auto &representative = resolved.choice ;
777
- if (!representative.isDecl ())
778
- return ;
779
-
780
- // Disable all of the overload choices which are different from
781
- // the one which is currently picked for representative.
782
- for (auto *constraint : disjunction->getNestedConstraints ()) {
783
- auto choice = constraint->getOverloadChoice ();
784
- if (!choice.isDecl () || choice.getDecl () == representative.getDecl ())
785
- continue ;
786
-
787
- constraint->setDisabled ();
788
- DisabledChoices.push_back (constraint);
789
- }
790
- break ;
791
- }
792
- };
793
-
794
748
// Figure out which of the solutions has the smallest score.
795
749
static std::optional<Score>
796
750
getBestScore (SmallVectorImpl<Solution> &solutions) {
0 commit comments