mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Property Wrappers] Use autoclosure information from CSApply to compute
`VarDecl::getPropertyWrapperInitValueInterfaceType`.
This commit is contained in:
@@ -6067,21 +6067,14 @@ bool VarDecl::isPropertyMemberwiseInitializedWithWrappedType() const {
|
||||
return allAttachedPropertyWrappersHaveWrappedValueInit();
|
||||
}
|
||||
|
||||
bool VarDecl::isInnermostPropertyWrapperInitUsesEscapingAutoClosure() const {
|
||||
auto customAttrs = getAttachedPropertyWrappers();
|
||||
if (customAttrs.empty())
|
||||
return false;
|
||||
|
||||
unsigned innermostWrapperIndex = customAttrs.size() - 1;
|
||||
auto typeInfo = getAttachedPropertyWrapperTypeInfo(innermostWrapperIndex);
|
||||
return typeInfo.isWrappedValueInitUsingEscapingAutoClosure;
|
||||
}
|
||||
|
||||
Type VarDecl::getPropertyWrapperInitValueInterfaceType() const {
|
||||
Type valueInterfaceTy = getValueInterfaceType();
|
||||
auto wrapperInfo = getPropertyWrapperBackingPropertyInfo();
|
||||
if (!wrapperInfo || !wrapperInfo.wrappedValuePlaceholder)
|
||||
return Type();
|
||||
|
||||
if (isInnermostPropertyWrapperInitUsesEscapingAutoClosure())
|
||||
return FunctionType::get({}, valueInterfaceTy);
|
||||
Type valueInterfaceTy = wrapperInfo.wrappedValuePlaceholder->getType();
|
||||
if (valueInterfaceTy->hasArchetype())
|
||||
valueInterfaceTy = valueInterfaceTy->mapTypeOutOfContext();
|
||||
|
||||
return valueInterfaceTy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user