@@ -804,9 +804,12 @@ unsigned constraints::getNumApplications(bool hasAppliedSelf,
804804// / Replaces property wrapper types in the parameter list of the given function type
805805// / with the wrapped-value or projected-value types (depending on argument label).
806806static FunctionType *
807- unwrapPropertyWrapperParameterTypes (ConstraintSystem &cs, AbstractFunctionDecl *funcDecl,
808- FunctionRefInfo functionRefInfo, FunctionType *functionType,
809- ConstraintLocatorBuilder locator) {
807+ unwrapPropertyWrapperParameterTypes (ConstraintSystem &cs,
808+ AbstractFunctionDecl *funcDecl,
809+ FunctionRefInfo functionRefInfo,
810+ FunctionType *functionType,
811+ ConstraintLocatorBuilder locator,
812+ PreparedOverload *preparedOverload) {
810813 // Only apply property wrappers to unapplied references to functions.
811814 if (!functionRefInfo.isUnapplied ())
812815 return functionType;
@@ -842,14 +845,15 @@ unwrapPropertyWrapperParameterTypes(ConstraintSystem &cs, AbstractFunctionDecl *
842845 }
843846
844847 auto *loc = cs.getConstraintLocator (locator);
845- auto *wrappedType = cs.createTypeVariable (loc, 0 );
848+ auto *wrappedType = cs.createTypeVariable (loc, 0 , preparedOverload );
846849 auto paramType = paramTypes[i].getParameterType ();
847850 auto paramLabel = paramTypes[i].getLabel ();
848851 auto paramInternalLabel = paramTypes[i].getInternalLabel ();
849852 adjustedParamTypes.push_back (AnyFunctionType::Param (
850853 wrappedType, paramLabel, ParameterTypeFlags (), paramInternalLabel));
851- cs.applyPropertyWrapperToParameter (paramType, wrappedType, paramDecl, argLabel,
852- ConstraintKind::Equal, loc, loc);
854+ cs.applyPropertyWrapperToParameter (
855+ paramType, wrappedType, paramDecl, argLabel, ConstraintKind::Equal,
856+ loc, loc, preparedOverload);
853857 }
854858
855859 return FunctionType::get (adjustedParamTypes, functionType->getResult (),
@@ -1049,7 +1053,7 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
10491053 ->removeArgumentLabels (numLabelsToRemove);
10501054 openedType = unwrapPropertyWrapperParameterTypes (
10511055 *this , funcDecl, functionRefInfo, openedType->castTo <FunctionType>(),
1052- locator);
1056+ locator, preparedOverload );
10531057
10541058 auto origOpenedType = openedType;
10551059 if (!isRequirementOrWitness (locator)) {
@@ -1821,8 +1825,9 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
18211825
18221826 // Strip off the 'self' parameter
18231827 auto *functionType = fullFunctionType->getResult ()->getAs <FunctionType>();
1824- functionType = unwrapPropertyWrapperParameterTypes (*this , funcDecl, functionRefInfo,
1825- functionType, locator);
1828+ functionType = unwrapPropertyWrapperParameterTypes (
1829+ *this , funcDecl, functionRefInfo, functionType,
1830+ locator, preparedOverload);
18261831 // FIXME: Verify ExtInfo state is correct, not working by accident.
18271832 FunctionType::ExtInfo info;
18281833
@@ -2494,18 +2499,33 @@ void PreparedOverload::discharge(ConstraintSystem &cs,
24942499 for (auto *tv : TypeVariables) {
24952500 cs.addTypeVariable (tv);
24962501 }
2502+
24972503 for (auto *c : Constraints) {
24982504 cs.addUnsolvedConstraint (c);
24992505 cs.activateConstraint (c);
25002506 }
2507+
25012508 cs.recordOpenedTypes (locator, Replacements);
2509+
25022510 if (OpenedExistential) {
25032511 cs.recordOpenedExistentialType (cs.getConstraintLocator (locator),
25042512 OpenedExistential);
25052513 }
2514+
25062515 for (auto pair : OpenedPackExpansionTypes) {
25072516 cs.recordOpenedPackExpansionType (pair.first , pair.second );
25082517 }
2518+
2519+ if (!PropertyWrappers.empty ()) {
2520+ Expr *anchor = getAsExpr (cs.getConstraintLocator (locator)->getAnchor ());
2521+ for (auto applied : PropertyWrappers) {
2522+ cs.applyPropertyWrapper (anchor, applied);
2523+ }
2524+ }
2525+
2526+ for (auto pair : Fixes) {
2527+ cs.recordFix (pair.first , pair.second );
2528+ }
25092529}
25102530
25112531void ConstraintSystem::resolveOverload (ConstraintLocator *locator,
0 commit comments