File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
test/Serialization/Safety Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -3888,7 +3888,17 @@ class DeclDeserializer {
3888
3888
opaqueDecl->setGenericSignature (genericSig);
3889
3889
else
3890
3890
opaqueDecl->setGenericSignature (GenericSignature ());
3891
- if (underlyingTypeSubsID) {
3891
+
3892
+ auto *AFD = dyn_cast<AbstractFunctionDecl>(namingDecl);
3893
+ if (MF.getResilienceStrategy () == ResilienceStrategy::Resilient &&
3894
+ !MF.FileContext ->getParentModule ()->isMainModule () &&
3895
+ AFD && AFD->getResilienceExpansion () != ResilienceExpansion::Minimal) {
3896
+ // Do not try to read the underlying type information if the function
3897
+ // is not inlinable in clients. This reflects the swiftinterface behavior
3898
+ // in where clients are only aware of the underlying type when the body
3899
+ // of the function is public.
3900
+
3901
+ } else if (underlyingTypeSubsID) {
3892
3902
auto subMapOrError = MF.getSubstitutionMapChecked (underlyingTypeSubsID);
3893
3903
if (!subMapOrError) {
3894
3904
// If the underlying type references internal details, ignore it.
Original file line number Diff line number Diff line change @@ -86,6 +86,30 @@ public struct PublicStruct {
86
86
}
87
87
}
88
88
89
+ // resultBuilder scenario
90
+ public protocol V { }
91
+
92
+ @resultBuilder
93
+ public struct VB {
94
+ public static func buildExpression< Content> ( _ content: Content ) -> Content where Content : V { fatalError ( ) }
95
+ public static func buildBlock( ) -> V { fatalError ( ) }
96
+ public static func buildBlock< Content> ( _ content: Content ) -> Content where Content : V { fatalError ( ) }
97
+ }
98
+
99
+ public struct EV : V {
100
+ public init ( ) { }
101
+ }
102
+
103
+ @available ( SwiftStdlib 5 . 1 , * )
104
+ public extension V {
105
+ @VB
106
+ func opaqueReferencingPrivate( ) -> some V {
107
+ referencedPrivateFunc ( v: EV ( ) )
108
+ }
109
+
110
+ private func referencedPrivateFunc( v: some V ) -> some V { return v }
111
+ }
112
+
89
113
//--- Client.swift
90
114
91
115
import Lib
@@ -94,3 +118,8 @@ var x = PublicStruct()
94
118
95
119
// Trigger a typo correction that reads all members.
96
120
x. notAMember ( ) // expected-error {{value of type 'PublicStruct' has no member 'notAMember'}}
121
+
122
+ if #available( SwiftStdlib 5 . 1 , * ) {
123
+ let v = EV ( )
124
+ let _ = v. opaqueReferencingPrivate ( )
125
+ }
You can’t perform that action at this time.
0 commit comments