@@ -245,14 +245,16 @@ Constraint::Constraint(ConstraintKind kind, Type first, Type second,
245
245
*getTrailingObjects<DeclContext *>() = useDC;
246
246
}
247
247
248
- Constraint::Constraint (Type type, OverloadChoice choice, DeclContext *useDC,
248
+ Constraint::Constraint (Type type, OverloadChoice choice,
249
+ PreparedOverload *preparedOverload,
250
+ DeclContext *useDC,
249
251
ConstraintFix *fix, ConstraintLocator *locator,
250
252
SmallPtrSetImpl<TypeVariableType *> &typeVars)
251
253
: Kind(ConstraintKind::BindOverload), NumTypeVariables(typeVars.size()),
252
254
HasFix(fix != nullptr ), HasDeclContext(true ), HasRestriction(false ),
253
255
IsActive(false ), IsDisabled(bool (fix)), IsDisabledForPerformance(false ),
254
256
RememberChoice(false ), IsFavored(false ), IsIsolated(false ),
255
- Overload{type}, Locator(locator) {
257
+ Overload{type, preparedOverload }, Locator(locator) {
256
258
std::copy (typeVars.begin (), typeVars.end (), getTypeVariablesBuffer ().begin ());
257
259
if (fix)
258
260
*getTrailingObjects<ConstraintFix *>() = fix;
@@ -893,10 +895,22 @@ Constraint *Constraint::createValueWitness(
893
895
}
894
896
895
897
Constraint *Constraint::createBindOverload (ConstraintSystem &cs, Type type,
896
- OverloadChoice choice,
898
+ OverloadChoice choice,
897
899
DeclContext *useDC,
898
900
ConstraintFix *fix,
899
901
ConstraintLocator *locator) {
902
+ // FIXME: Transitional hack.
903
+ bool enablePreparedOverloads = false ;
904
+
905
+ PreparedOverload *preparedOverload = nullptr ;
906
+
907
+ // Prepare the overload.
908
+ if (enablePreparedOverloads) {
909
+ if (choice.canBePrepared ()) {
910
+ preparedOverload = cs.prepareOverload (locator, choice, useDC);
911
+ }
912
+ }
913
+
900
914
// Collect type variables.
901
915
SmallPtrSet<TypeVariableType *, 4 > typeVars;
902
916
if (type->hasTypeVariable ())
@@ -912,7 +926,8 @@ Constraint *Constraint::createBindOverload(ConstraintSystem &cs, Type type,
912
926
typeVars.size (), fix ? 1 : 0 , /* hasDeclContext=*/ 1 ,
913
927
/* hasContextualTypeInfo=*/ 0 , /* hasOverloadChoice=*/ 1 );
914
928
void *mem = cs.getAllocator ().Allocate (size, alignof (Constraint));
915
- return new (mem) Constraint (type, choice, useDC, fix, locator, typeVars);
929
+ return new (mem) Constraint (type, choice, preparedOverload, useDC,
930
+ fix, locator, typeVars);
916
931
}
917
932
918
933
Constraint *Constraint::createRestricted (ConstraintSystem &cs,
0 commit comments