@@ -805,7 +805,8 @@ Constraint *Constraint::createMemberOrOuterDisjunction(
805
805
memberConstraint->setFavored ();
806
806
for (auto choice : outerAlternatives) {
807
807
constraints.push_back (
808
- Constraint::createBindOverload (cs, first, choice, useDC, locator));
808
+ Constraint::createBindOverload (cs, first, choice, useDC, /* fix=*/ nullptr ,
809
+ locator));
809
810
}
810
811
return Constraint::createDisjunction (cs, constraints, locator, ForgetChoice);
811
812
}
@@ -856,8 +857,22 @@ Constraint *Constraint::createValueWitness(
856
857
Constraint *Constraint::createBindOverload (ConstraintSystem &cs, Type type,
857
858
OverloadChoice choice,
858
859
DeclContext *useDC,
860
+ ConstraintFix *fix,
859
861
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);
861
876
}
862
877
863
878
Constraint *Constraint::createRestricted (ConstraintSystem &cs,
@@ -899,27 +914,6 @@ Constraint *Constraint::createFixed(ConstraintSystem &cs, ConstraintKind kind,
899
914
return new (mem) Constraint (kind, fix, first, second, locator, typeVars);
900
915
}
901
916
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
-
923
917
Constraint *Constraint::createDisjunction (ConstraintSystem &cs,
924
918
ArrayRef<Constraint *> constraints,
925
919
ConstraintLocator *locator,
0 commit comments