@@ -805,7 +805,8 @@ Constraint *Constraint::createMemberOrOuterDisjunction(
805805 memberConstraint->setFavored ();
806806 for (auto choice : outerAlternatives) {
807807 constraints.push_back (
808- Constraint::createBindOverload (cs, first, choice, useDC, locator));
808+ Constraint::createBindOverload (cs, first, choice, useDC, /* fix=*/ nullptr ,
809+ locator));
809810 }
810811 return Constraint::createDisjunction (cs, constraints, locator, ForgetChoice);
811812}
@@ -856,8 +857,22 @@ Constraint *Constraint::createValueWitness(
856857Constraint *Constraint::createBindOverload (ConstraintSystem &cs, Type type,
857858 OverloadChoice choice,
858859 DeclContext *useDC,
860+ ConstraintFix *fix,
859861 ConstraintLocator *locator) {
860- return createFixedChoice (cs, type, choice, useDC, /* fix=*/ nullptr , locator);
862+ // Collect type variables.
863+ SmallPtrSet<TypeVariableType *, 4 > typeVars;
864+ if (type->hasTypeVariable ())
865+ type->getTypeVariables (typeVars);
866+ if (auto baseType = choice.getBaseType ()) {
867+ baseType->getTypeVariables (typeVars);
868+ }
869+
870+ // Create the constraint.
871+ auto size =
872+ totalSizeToAlloc<TypeVariableType *, ConstraintFix *, OverloadChoice>(
873+ typeVars.size (), fix ? 1 : 0 , /* hasOverloadChoice=*/ 1 );
874+ void *mem = cs.getAllocator ().Allocate (size, alignof (Constraint));
875+ return new (mem) Constraint (type, choice, useDC, fix, locator, typeVars);
861876}
862877
863878Constraint *Constraint::createRestricted (ConstraintSystem &cs,
@@ -899,27 +914,6 @@ Constraint *Constraint::createFixed(ConstraintSystem &cs, ConstraintKind kind,
899914 return new (mem) Constraint (kind, fix, first, second, locator, typeVars);
900915}
901916
902- Constraint *Constraint::createFixedChoice (ConstraintSystem &cs, Type type,
903- OverloadChoice choice,
904- DeclContext *useDC,
905- ConstraintFix *fix,
906- ConstraintLocator *locator) {
907- // Collect type variables.
908- SmallPtrSet<TypeVariableType *, 4 > typeVars;
909- if (type->hasTypeVariable ())
910- type->getTypeVariables (typeVars);
911- if (auto baseType = choice.getBaseType ()) {
912- baseType->getTypeVariables (typeVars);
913- }
914-
915- // Create the constraint.
916- auto size =
917- totalSizeToAlloc<TypeVariableType *, ConstraintFix *, OverloadChoice>(
918- typeVars.size (), fix ? 1 : 0 , /* hasOverloadChoice=*/ 1 );
919- void *mem = cs.getAllocator ().Allocate (size, alignof (Constraint));
920- return new (mem) Constraint (type, choice, useDC, fix, locator, typeVars);
921- }
922-
923917Constraint *Constraint::createDisjunction (ConstraintSystem &cs,
924918 ArrayRef<Constraint *> constraints,
925919 ConstraintLocator *locator,
0 commit comments