@@ -639,59 +639,6 @@ bool DisjunctionStep::shouldSkip(const DisjunctionChoice &choice) const {
639
639
}
640
640
}
641
641
642
- // If the solver already found a solution with a choice that did not
643
- // introduce any conversions (i.e., the score is not worse than the
644
- // current score), we can skip any generic operators with conformance
645
- // requirements that are not satisfied by any known argument types.
646
- auto argFnType = CS.getAppliedDisjunctionArgumentFunction (Disjunction);
647
- auto checkRequirementsEarly = [&]() -> bool {
648
- auto bestScore = getBestScore (Solutions);
649
- if (!(bestScore && choice.isGenericOperator () && argFnType))
650
- return false ;
651
-
652
- auto currentScore = getCurrentScore ();
653
- for (unsigned i = 0 ; i < NumScoreKinds; ++i) {
654
- if (i == SK_NonDefaultLiteral)
655
- continue ;
656
-
657
- if (bestScore->Data [i] > currentScore.Data [i])
658
- return false ;
659
- }
660
-
661
- return true ;
662
- };
663
- if (checkRequirementsEarly ()) {
664
- Constraint *constraint = choice;
665
- auto *decl = constraint->getOverloadChoice ().getDecl ();
666
- if (decl->getBaseIdentifier ().isArithmeticOperator ()) {
667
- auto *useDC = constraint->getOverloadUseDC ();
668
- auto choiceType = CS.getEffectiveOverloadType (
669
- constraint->getLocator (), constraint->getOverloadChoice (),
670
- /* allowMembers=*/ true , useDC);
671
- auto choiceFnType = choiceType->getAs <FunctionType>();
672
- auto genericFnType = decl->getInterfaceType ()->getAs <GenericFunctionType>();
673
- auto signature = genericFnType->getGenericSignature ();
674
-
675
- for (auto argParamPair : llvm::zip (argFnType->getParams (),
676
- choiceFnType->getParams ())) {
677
- auto argType = std::get<0 >(argParamPair).getPlainType ();
678
- auto paramType = std::get<1 >(argParamPair).getPlainType ();
679
-
680
- // Only check argument types with no type variables that will be matched
681
- // against a plain type parameter.
682
- argType = argType->getCanonicalType ()->getWithoutSpecifierType ();
683
- if (argType->hasTypeVariable () || !paramType->isTypeParameter ())
684
- continue ;
685
-
686
- for (auto *protocol : signature->getRequiredProtocols (paramType)) {
687
- if (!TypeChecker::conformsToProtocol (argType, protocol,
688
- useDC->getParentModule ()))
689
- return skip (" unsatisfied" );
690
- }
691
- }
692
- }
693
- }
694
-
695
642
// Don't attempt to solve for generic operators if we already have
696
643
// a non-generic solution.
697
644
0 commit comments