mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Property wrappers] Fix handling of @autoclosure in init(wrappedValue:)
If the 'wrappedValue:' parameter is an escaping autoclosure, and a struct property is marked with that property wrapper, the memberwise initializer of the struct is now synthesized with an escaping autoclosure for that property.
This commit is contained in:
committed by
Doug Gregor
parent
7bc4148bda
commit
9c2dca7d6a
@@ -750,7 +750,8 @@ void SILGenFunction::emitGeneratorFunction(SILDeclRef function, Expr *value,
|
||||
ctx.getIdentifier("$input_value"),
|
||||
dc);
|
||||
param->setSpecifier(ParamSpecifier::Owned);
|
||||
param->setInterfaceType(function.getDecl()->getInterfaceType());
|
||||
auto vd = cast<VarDecl>(function.getDecl());
|
||||
param->setInterfaceType(vd->getPropertyWrapperInitValueInterfaceType());
|
||||
|
||||
params = ParameterList::create(ctx, SourceLoc(), {param}, SourceLoc());
|
||||
}
|
||||
@@ -800,7 +801,7 @@ void SILGenFunction::emitGeneratorFunction(SILDeclRef function, VarDecl *var) {
|
||||
// will be in terms of the original property's type.
|
||||
if (auto originalProperty = var->getOriginalWrappedProperty()) {
|
||||
if (originalProperty->isPropertyMemberwiseInitializedWithWrappedType()) {
|
||||
interfaceType = originalProperty->getValueInterfaceType();
|
||||
interfaceType = originalProperty->getPropertyWrapperInitValueInterfaceType();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user