@@ -804,9 +804,12 @@ unsigned constraints::getNumApplications(bool hasAppliedSelf,
804
804
// / Replaces property wrapper types in the parameter list of the given function type
805
805
// / with the wrapped-value or projected-value types (depending on argument label).
806
806
static 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) {
810
813
// Only apply property wrappers to unapplied references to functions.
811
814
if (!functionRefInfo.isUnapplied ())
812
815
return functionType;
@@ -842,14 +845,15 @@ unwrapPropertyWrapperParameterTypes(ConstraintSystem &cs, AbstractFunctionDecl *
842
845
}
843
846
844
847
auto *loc = cs.getConstraintLocator (locator);
845
- auto *wrappedType = cs.createTypeVariable (loc, 0 );
848
+ auto *wrappedType = cs.createTypeVariable (loc, 0 , preparedOverload );
846
849
auto paramType = paramTypes[i].getParameterType ();
847
850
auto paramLabel = paramTypes[i].getLabel ();
848
851
auto paramInternalLabel = paramTypes[i].getInternalLabel ();
849
852
adjustedParamTypes.push_back (AnyFunctionType::Param (
850
853
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);
853
857
}
854
858
855
859
return FunctionType::get (adjustedParamTypes, functionType->getResult (),
@@ -1049,7 +1053,7 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
1049
1053
->removeArgumentLabels (numLabelsToRemove);
1050
1054
openedType = unwrapPropertyWrapperParameterTypes (
1051
1055
*this , funcDecl, functionRefInfo, openedType->castTo <FunctionType>(),
1052
- locator);
1056
+ locator, preparedOverload );
1053
1057
1054
1058
auto origOpenedType = openedType;
1055
1059
if (!isRequirementOrWitness (locator)) {
@@ -1821,8 +1825,9 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
1821
1825
1822
1826
// Strip off the 'self' parameter
1823
1827
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);
1826
1831
// FIXME: Verify ExtInfo state is correct, not working by accident.
1827
1832
FunctionType::ExtInfo info;
1828
1833
@@ -2494,18 +2499,33 @@ void PreparedOverload::discharge(ConstraintSystem &cs,
2494
2499
for (auto *tv : TypeVariables) {
2495
2500
cs.addTypeVariable (tv);
2496
2501
}
2502
+
2497
2503
for (auto *c : Constraints) {
2498
2504
cs.addUnsolvedConstraint (c);
2499
2505
cs.activateConstraint (c);
2500
2506
}
2507
+
2501
2508
cs.recordOpenedTypes (locator, Replacements);
2509
+
2502
2510
if (OpenedExistential) {
2503
2511
cs.recordOpenedExistentialType (cs.getConstraintLocator (locator),
2504
2512
OpenedExistential);
2505
2513
}
2514
+
2506
2515
for (auto pair : OpenedPackExpansionTypes) {
2507
2516
cs.recordOpenedPackExpansionType (pair.first , pair.second );
2508
2517
}
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
+ }
2509
2529
}
2510
2530
2511
2531
void ConstraintSystem::resolveOverload (ConstraintLocator *locator,
0 commit comments