You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sema: Fix superfluous error about private decls in internal memory layouts
Don't consider implicitly exposed memory layouts when checking for
usable from inline correctness. That check applies only to memory
layouts marked as exposed explicitly. Consider the implict state only at
the general availability checking.
@@ -163,12 +165,26 @@ public struct ExposedLayoutPublicUser {
163
165
// expected-opt-in-error @-1 {{cannot use struct 'StructFromDirect' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'directs' has been imported as implementation-only}}
164
166
165
167
privatevara:ExposedLayoutPublic
168
+
privatevaraa:ExposedLayoutInternal
166
169
privatevarb:ExposedLayoutPrivate
167
-
// expected-opt-in-error @-1 {{type referenced from a stored property in a '@frozen' struct must be '@usableFromInline' or public}}
168
170
169
171
privatevarc:HiddenLayout
170
172
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is a struct marked '@_implementationOnly'}}
171
-
// expected-opt-in-error @-2 {{type referenced from a stored property in a '@frozen' struct must be '@usableFromInline' or public}}
173
+
174
+
privatefunc privateFunc(h:HiddenLayout){}
175
+
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because it is a struct marked '@_implementationOnly'}}
176
+
}
177
+
178
+
privatestructExposedLayoutInternalUser{
179
+
180
+
privatevarprivateField:StructFromDirect
181
+
// expected-opt-in-error @-1 {{cannot use struct 'StructFromDirect' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'directs' has been imported as implementation-only}}
182
+
183
+
privatevara:ExposedLayoutPublic
184
+
privatevaraa:ExposedLayoutInternal
185
+
privatevarb:ExposedLayoutPrivate
186
+
privatevarc:HiddenLayout
187
+
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is a struct marked '@_implementationOnly'}}
172
188
173
189
privatefunc privateFunc(h:HiddenLayout){}
174
190
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because it is a struct marked '@_implementationOnly'}}
// expected-opt-in-error @-1 {{cannot use struct 'StructFromDirect' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'directs' has been imported as implementation-only}}
181
197
182
198
privatevara:ExposedLayoutPublic
199
+
privatevaraa:ExposedLayoutInternal
183
200
privatevarb:ExposedLayoutPrivate
184
201
privatevarc:HiddenLayout
185
202
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is a struct marked '@_implementationOnly'}}
0 commit comments