@@ -3590,7 +3590,7 @@ static bool generateWrappedPropertyTypeConstraints(
3590
3590
auto dc = wrappedVar->getInnermostDeclContext ();
3591
3591
3592
3592
Type wrappedValueType;
3593
- Type wrapperType = initializerType ;
3593
+ Type wrapperType;
3594
3594
auto wrapperAttributes = wrappedVar->getAttachedPropertyWrappers ();
3595
3595
for (unsigned i : indices (wrapperAttributes)) {
3596
3596
// FIXME: We should somehow pass an OpenUnboundGenericTypeFn to
@@ -3602,19 +3602,25 @@ static bool generateWrappedPropertyTypeConstraints(
3602
3602
return true ;
3603
3603
3604
3604
auto *typeExpr = wrapperAttributes[i]->getTypeExpr ();
3605
- auto *locator = cs.getConstraintLocator (typeExpr, LocatorPathElt::WrappedValue (wrapperType.getPointer ()));
3606
- wrapperType = cs.replaceInferableTypesWithTypeVars (rawWrapperType, locator);
3607
- cs.setType (typeExpr, wrapperType);
3608
3605
3609
3606
if (!wrappedValueType) {
3610
3607
// Equate the outermost wrapper type to the initializer type.
3608
+ auto *locator = cs.getConstraintLocator (typeExpr);
3609
+ wrapperType =
3610
+ cs.replaceInferableTypesWithTypeVars (rawWrapperType, locator);
3611
3611
if (initializerType)
3612
3612
cs.addConstraint (ConstraintKind::Equal, wrapperType, initializerType, locator);
3613
3613
} else {
3614
3614
// The former wrappedValue type must be equal to the current wrapper type
3615
+ auto *locator = cs.getConstraintLocator (
3616
+ typeExpr, LocatorPathElt::WrappedValue (wrapperType.getPointer ()));
3617
+ wrapperType =
3618
+ cs.replaceInferableTypesWithTypeVars (rawWrapperType, locator);
3615
3619
cs.addConstraint (ConstraintKind::Equal, wrapperType, wrappedValueType, locator);
3616
3620
}
3617
3621
3622
+ cs.setType (typeExpr, wrapperType);
3623
+
3618
3624
wrappedValueType = wrapperType->getTypeOfMember (
3619
3625
dc->getParentModule (), wrapperInfo.valueVar );
3620
3626
}
0 commit comments