@@ -245,14 +245,16 @@ Constraint::Constraint(ConstraintKind kind, Type first, Type second,
245245 *getTrailingObjects<DeclContext *>() = useDC;
246246}
247247
248- Constraint::Constraint (Type type, OverloadChoice choice, DeclContext *useDC,
248+ Constraint::Constraint (Type type, OverloadChoice choice,
249+ PreparedOverload *preparedOverload,
250+ DeclContext *useDC,
249251 ConstraintFix *fix, ConstraintLocator *locator,
250252 SmallPtrSetImpl<TypeVariableType *> &typeVars)
251253 : Kind(ConstraintKind::BindOverload), NumTypeVariables(typeVars.size()),
252254 HasFix(fix != nullptr ), HasDeclContext(true ), HasRestriction(false ),
253255 IsActive(false ), IsDisabled(bool (fix)), IsDisabledForPerformance(false ),
254256 RememberChoice(false ), IsFavored(false ), IsIsolated(false ),
255- Overload{type}, Locator(locator) {
257+ Overload{type, preparedOverload }, Locator(locator) {
256258 std::copy (typeVars.begin (), typeVars.end (), getTypeVariablesBuffer ().begin ());
257259 if (fix)
258260 *getTrailingObjects<ConstraintFix *>() = fix;
@@ -893,10 +895,22 @@ Constraint *Constraint::createValueWitness(
893895}
894896
895897Constraint *Constraint::createBindOverload (ConstraintSystem &cs, Type type,
896- OverloadChoice choice,
898+ OverloadChoice choice,
897899 DeclContext *useDC,
898900 ConstraintFix *fix,
899901 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+
900914 // Collect type variables.
901915 SmallPtrSet<TypeVariableType *, 4 > typeVars;
902916 if (type->hasTypeVariable ())
@@ -912,7 +926,8 @@ Constraint *Constraint::createBindOverload(ConstraintSystem &cs, Type type,
912926 typeVars.size (), fix ? 1 : 0 , /* hasDeclContext=*/ 1 ,
913927 /* hasContextualTypeInfo=*/ 0 , /* hasOverloadChoice=*/ 1 );
914928 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);
916931}
917932
918933Constraint *Constraint::createRestricted (ConstraintSystem &cs,
0 commit comments