@@ -1930,11 +1930,17 @@ static void addPropertyWrapperAccessorAvailability(VarDecl *var, AccessorKind ac
1930
1930
SmallVectorImpl<const Decl *> &asAvailableAs) {
1931
1931
AccessorDecl *synthesizedFrom = nullptr ;
1932
1932
if (var->hasAttachedPropertyWrapper ()) {
1933
+ AbstractStorageDecl *wrappedValueImpl;
1934
+ if (auto access = getEnclosingSelfPropertyWrapperAccess (var, /* forProjected=*/ false )) {
1935
+ wrappedValueImpl = access->subscript ;
1936
+ } else {
1937
+ wrappedValueImpl = var->getAttachedPropertyWrapperTypeInfo (0 ).valueVar ;
1938
+ }
1939
+
1933
1940
// The property wrapper info may not actually link back to a wrapper
1934
1941
// implementation, if there was a semantic error checking the wrapper.
1935
- auto info = var->getAttachedPropertyWrapperTypeInfo (0 );
1936
- if (info.valueVar ) {
1937
- synthesizedFrom = info.valueVar ->getOpaqueAccessor (accessorKind);
1942
+ if (wrappedValueImpl) {
1943
+ synthesizedFrom = wrappedValueImpl->getOpaqueAccessor (accessorKind);
1938
1944
}
1939
1945
} else if (auto wrapperSynthesizedKind
1940
1946
= var->getPropertyWrapperSynthesizedPropertyKind ()) {
@@ -1944,11 +1950,17 @@ static void addPropertyWrapperAccessorAvailability(VarDecl *var, AccessorKind ac
1944
1950
1945
1951
case PropertyWrapperSynthesizedPropertyKind::Projection: {
1946
1952
if (auto origVar = var->getOriginalWrappedProperty (wrapperSynthesizedKind)) {
1953
+ AbstractStorageDecl *projectedValueImpl;
1954
+ if (auto access = getEnclosingSelfPropertyWrapperAccess (origVar, /* forProjected=*/ true )) {
1955
+ projectedValueImpl = access->subscript ;
1956
+ } else {
1957
+ projectedValueImpl = origVar->getAttachedPropertyWrapperTypeInfo (0 ).projectedValueVar ;
1958
+ }
1959
+
1947
1960
// The property wrapper info may not actually link back to a wrapper
1948
1961
// implementation, if there was a semantic error checking the wrapper.
1949
- auto info = origVar->getAttachedPropertyWrapperTypeInfo (0 );
1950
- if (info.projectedValueVar ) {
1951
- synthesizedFrom = info.projectedValueVar ->getOpaqueAccessor (accessorKind);
1962
+ if (projectedValueImpl) {
1963
+ synthesizedFrom = projectedValueImpl->getOpaqueAccessor (accessorKind);
1952
1964
}
1953
1965
}
1954
1966
break ;
0 commit comments