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
@_implementationOnly // expected-opt-in-error {{'@_implementationOnly' may not be used on public declarations}}
223
223
publicstructPublicHiddenStruct{}
224
224
#endif
225
+
226
+
/// Classes use sites
227
+
228
+
publicclassPublicClass{
229
+
publicinit(){fatalError()}
230
+
231
+
publicvarpublicField:StructFromDirect
232
+
// expected-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}}
233
+
234
+
privatevarprivateField:StructFromDirect
235
+
// 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}}
236
+
privatevara:ExposedLayoutPublic
237
+
privatevaraa:ExposedLayoutInternal
238
+
privatevarb:ExposedLayoutPrivate
239
+
privatevarc:HiddenLayout
240
+
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenLayout' is marked '@_implementationOnly'}}
241
+
242
+
privatevard:ExposedEnumPublic
243
+
privatevare:ExposedEnumPrivate
244
+
245
+
@_neverEmitIntoClient
246
+
privatefunc privateFunc(h:HiddenLayout){}
247
+
}
248
+
249
+
internalclassInternalClass{
250
+
publicinit(){fatalError()}
251
+
252
+
publicvarpublicField:StructFromDirect
253
+
// 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}}
254
+
privatevarprivateField:StructFromDirect
255
+
// 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}}
256
+
257
+
privatevara:ExposedLayoutPublic
258
+
privatevaraa:ExposedLayoutInternal
259
+
privatevarb:ExposedLayoutPrivate
260
+
privatevarc:HiddenLayout
261
+
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenLayout' is marked '@_implementationOnly'}}
262
+
263
+
privatevard:ExposedEnumPublic
264
+
privatevare:ExposedEnumPrivate
265
+
266
+
privatefunc privateFunc(h:HiddenLayout){} // expected-embedded-opt-in-error {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because 'HiddenLayout' is marked '@_implementationOnly'}}
267
+
}
268
+
269
+
privateclassPrivateClass{
270
+
publicinit(){fatalError()}
271
+
272
+
publicvarpublicField:StructFromDirect
273
+
// 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}}
274
+
privatevarprivateField:StructFromDirect
275
+
// 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}}
276
+
277
+
privatevara:ExposedLayoutPublic
278
+
privatevaraa:ExposedLayoutInternal
279
+
privatevarb:ExposedLayoutPrivate
280
+
privatevarc:HiddenLayout
281
+
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenLayout' is marked '@_implementationOnly'}}
282
+
283
+
privatevard:ExposedEnumPublic
284
+
privatevare:ExposedEnumPrivate
285
+
286
+
privatefunc privateFunc(h:HiddenLayout){} // expected-embedded-opt-in-error {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@_neverEmitIntoClient' because 'HiddenLayout' is marked '@_implementationOnly'}}
287
+
}
288
+
289
+
#if UseImplementationOnly
290
+
@_implementationOnly
291
+
internalclassHiddenClass{
292
+
publicinit(){fatalError()}
293
+
294
+
publicvarpublicField:StructFromDirect
295
+
privatevarprivateField:StructFromDirect
296
+
297
+
privatevara:ExposedLayoutPublic
298
+
privatevaraa:ExposedLayoutInternal
299
+
privatevarb:ExposedLayoutPrivate
300
+
privatevarc:HiddenLayout
301
+
302
+
privatevard:ExposedEnumPublic
303
+
privatevare:ExposedEnumPrivate
304
+
}
305
+
306
+
@_implementationOnly // expected-opt-in-error {{'@_implementationOnly' may not be used on public declarations}}
0 commit comments