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
@@ -138,6 +165,14 @@ public func explicitlyInlinable() {
138
165
let _:HiddenEnum=HiddenEnum.A
139
166
// expected-error @-1 2 {{enum 'HiddenEnum' is private and cannot be referenced from an '@inlinable' function}}
140
167
// expected-error @-2 {{enum case 'A' is private and cannot be referenced from an '@inlinable' function}}
168
+
169
+
let _:ExposedProtocolPublic
170
+
let _:ExposedProtocolInternal
171
+
// expected-error @-1 {{protocol 'ExposedProtocolInternal' is internal and cannot be referenced from an '@inlinable' function}}
172
+
let _:ExposedProtocolPrivate
173
+
// expected-error @-1 {{protocol 'ExposedProtocolPrivate' is private and cannot be referenced from an '@inlinable' function}}
174
+
let _:HiddenProtocol
175
+
// expected-error @-1 {{protocol 'HiddenProtocol' is private and cannot be referenced from an '@inlinable' function}}
141
176
}
142
177
143
178
publicfunc implicitlyInlinablePublic(){
@@ -150,6 +185,12 @@ public func implicitlyInlinablePublic() {
150
185
let _:ExposedEnumPrivate=ExposedEnumPrivate.A
151
186
let _:HiddenEnum=HiddenEnum.A
152
187
// expected-embedded-opt-in-error @-1 2 {{enum 'HiddenEnum' cannot be used in an embedded function not marked '@export(interface)' because 'HiddenEnum' is marked '@_implementationOnly'}}
188
+
189
+
let _:ExposedProtocolPublic
190
+
let _:ExposedProtocolInternal
191
+
let _:ExposedProtocolPrivate
192
+
let _:HiddenProtocol
193
+
// expected-embedded-opt-in-error @-1 {{protocol 'HiddenProtocol' cannot be used in an embedded function not marked '@export(interface)' because 'HiddenProtocol' is marked '@_implementationOnly'}}
// expected-embedded-opt-in-error @-1 2 {{enum 'HiddenEnum' cannot be used in an embedded function not marked '@export(interface)' because 'HiddenEnum' is marked '@_implementationOnly'}}
206
+
207
+
let _:ExposedProtocolPublic
208
+
let _:ExposedProtocolInternal
209
+
let _:ExposedProtocolPrivate
210
+
let _:HiddenProtocol
211
+
// expected-embedded-opt-in-error @-1 {{protocol 'HiddenProtocol' cannot be used in an embedded function not marked '@export(interface)' because 'HiddenProtocol' is marked '@_implementationOnly'}}
165
212
}
166
213
167
214
@export(interface)
@@ -172,6 +219,11 @@ public func explicitNonInliable() {
@@ -198,7 +255,6 @@ public struct ExposedLayoutPublicUser: ProtocolFromDirect {
198
255
privatevara:ExposedLayoutPublic
199
256
privatevaraa:ExposedLayoutInternal
200
257
privatevarb:ExposedLayoutPrivate
201
-
202
258
privatevarc:HiddenLayout
203
259
// 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'}}
204
260
@@ -207,6 +263,15 @@ public struct ExposedLayoutPublicUser: ProtocolFromDirect {
207
263
privatevarf:HiddenEnum
208
264
// expected-opt-in-error @-1 {{cannot use enum 'HiddenEnum' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenEnum' is marked '@_implementationOnly'}}
209
265
266
+
privatevarpp:ProtocolFromDirect
267
+
// expected-opt-in-error @-1 {{cannot use protocol 'ProtocolFromDirect' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'directs' has been imported as implementation-only}}
268
+
269
+
privatevarg:ExposedProtocolPublic
270
+
privatevarh:ExposedProtocolInternal
271
+
privatevari:ExposedProtocolPrivate
272
+
privatevarj:HiddenProtocol
273
+
// expected-opt-in-error @-1 {{cannot use protocol 'HiddenProtocol' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenProtocol' is marked '@_implementationOnly'}}
274
+
210
275
privatefunc privateFunc(h:HiddenLayout){}
211
276
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@export(interface)' because 'HiddenLayout' is marked '@_implementationOnly'}}
// expected-opt-in-error @-1 {{cannot use enum 'HiddenEnum' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenEnum' is marked '@_implementationOnly'}}
230
295
296
+
privatevarg:ExposedProtocolPublic
297
+
privatevarh:ExposedProtocolInternal
298
+
privatevari:ExposedProtocolPrivate
299
+
privatevarj:HiddenProtocol
300
+
// expected-opt-in-error @-1 {{cannot use protocol 'HiddenProtocol' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenProtocol' is marked '@_implementationOnly'}}
301
+
231
302
privatefunc privateFunc(h:HiddenLayout){}
232
303
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@export(interface)' because 'HiddenLayout' is marked '@_implementationOnly'}}
// expected-opt-in-error @-1 {{cannot use enum 'HiddenEnum' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenEnum' is marked '@_implementationOnly'}}
251
322
323
+
privatevarg:ExposedProtocolPublic
324
+
privatevarh:ExposedProtocolInternal
325
+
privatevari:ExposedProtocolPrivate
326
+
privatevarj:HiddenProtocol
327
+
// expected-opt-in-error @-1 {{cannot use protocol 'HiddenProtocol' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenProtocol' is marked '@_implementationOnly'}}
328
+
252
329
privatefunc privateFunc(h:HiddenLayout){}
253
330
// expected-embedded-opt-in-error @-1 {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@export(interface)' because 'HiddenLayout' is marked '@_implementationOnly'}}
@_implementationOnly // expected-opt-in-error {{'@_implementationOnly' may not be used on public declarations}}
274
357
publicstructPublicHiddenStruct{}
275
358
276
-
277
359
#endif
278
360
279
361
/// Enums use sites
280
362
281
363
publicenumPublicEnumUser:ProtocolFromDirect{
282
364
// expected-error @-1 {{cannot use protocol 'ProtocolFromDirect' in a public or '@usableFromInline' conformance; 'directs' has been imported as implementation-only}}
283
365
case a(StructFromDirect) // expected-error {{cannot use struct 'StructFromDirect' here; 'directs' has been imported as implementation-only}}
284
-
case b(HiddenLayout) // expected-error {{enum case in a public enum uses a private type}}
285
-
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' here; 'HiddenLayout' is marked '@_implementationOnly'}}
366
+
367
+
case e(ExposedLayoutPublic)
286
368
case c(ExposedLayoutInternal) // expected-error {{enum case in a public enum uses an internal type}}
287
369
case d(ExposedLayoutPrivate) // expected-error {{enum case in a public enum uses a private type}}
288
-
case e(ExposedLayoutPublic)
370
+
case b(HiddenLayout) // expected-error {{enum case in a public enum uses a private type}}
371
+
// expected-opt-in-error @-1 {{cannot use struct 'HiddenLayout' here; 'HiddenLayout' is marked '@_implementationOnly'}}
372
+
373
+
case f(ExposedProtocolPublic)
374
+
case g(ExposedProtocolInternal) // expected-error {{enum case in a public enum uses an internal type}}
375
+
case h(ExposedProtocolPrivate) // expected-error {{enum case in a public enum uses a private type}}
376
+
case i(HiddenProtocol) // expected-opt-in-error {{cannot use protocol 'HiddenProtocol' here; 'HiddenProtocol' is marked '@_implementationOnly'}}
377
+
// expected-error @-1 {{enum case in a public enum uses a private type}}
289
378
}
290
379
291
380
internalenumInternalEnumUser:ProtocolFromDirect{
292
381
// expected-opt-in-error @-1 {{cannot use protocol 'ProtocolFromDirect' in a public or '@usableFromInline' conformance; 'directs' has been imported as implementation-only}}
293
382
case a(StructFromDirect) // expected-opt-in-error {{cannot use struct 'StructFromDirect' here; 'directs' has been imported as implementation-only}}
294
-
case b(HiddenLayout) // expected-opt-in-error {{cannot use struct 'HiddenLayout' here; 'HiddenLayout' is marked '@_implementationOnly'}}
295
-
// expected-error @-1 {{enum case in an internal enum uses a private type}}
383
+
384
+
casee(ExposedLayoutPublic)
296
385
case c(ExposedLayoutInternal)
297
386
case d(ExposedLayoutPrivate) // expected-error {{enum case in an internal enum uses a private type}}
298
-
case e(ExposedLayoutPublic)
387
+
case b(HiddenLayout) // expected-opt-in-error {{cannot use struct 'HiddenLayout' here; 'HiddenLayout' is marked '@_implementationOnly'}}
388
+
// expected-error @-1 {{enum case in an internal enum uses a private type}}
389
+
390
+
case f(ExposedProtocolPublic)
391
+
case g(ExposedProtocolInternal)
392
+
case h(ExposedProtocolPrivate) // expected-error {{enum case in an internal enum uses a private type}}
393
+
case i(HiddenProtocol) // expected-opt-in-error {{cannot use protocol 'HiddenProtocol' here; 'HiddenProtocol' is marked '@_implementationOnly'}}
394
+
// expected-error @-1 {{enum case in an internal enum uses a private type}}
299
395
}
300
396
301
397
privateenumPrivateEnumUser:ProtocolFromDirect{
302
398
// expected-opt-in-error @-1 {{cannot use protocol 'ProtocolFromDirect' in a public or '@usableFromInline' conformance; 'directs' has been imported as implementation-only}}
303
399
case a(StructFromDirect) // expected-opt-in-error {{cannot use struct 'StructFromDirect' here; 'directs' has been imported as implementation-only}}
304
-
case b(HiddenLayout) // expected-opt-in-error {{cannot use struct 'HiddenLayout' here; 'HiddenLayout' is marked '@_implementationOnly'}}
400
+
401
+
case e(ExposedLayoutPublic)
305
402
case c(ExposedLayoutInternal)
306
403
case d(ExposedLayoutPrivate)
307
-
case e(ExposedLayoutPublic)
404
+
case b(HiddenLayout) // expected-opt-in-error {{cannot use struct 'HiddenLayout' here; 'HiddenLayout' is marked '@_implementationOnly'}}
405
+
406
+
case f(ExposedProtocolPublic)
407
+
case g(ExposedProtocolInternal)
408
+
case h(ExposedProtocolPrivate)
409
+
case i(HiddenProtocol) // expected-opt-in-error {{cannot use protocol 'HiddenProtocol' here; 'HiddenProtocol' is marked '@_implementationOnly'}}
308
410
}
309
411
310
412
internalenumInternalEnumWithRawType:RawTypeFromDirect{ // expected-opt-in-error {{cannot use struct 'RawTypeFromDirect' in a public or '@usableFromInline' conformance; 'directs' has been imported as implementation-only}}
@_implementationOnly // expected-opt-in-error {{'@_implementationOnly' may not be used on public declarations}}
@@ -356,6 +464,12 @@ public class PublicClass: ProtocolFromDirect {
356
464
privatevarf:HiddenEnum
357
465
// expected-opt-in-error @-1 {{cannot use enum 'HiddenEnum' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenEnum' is marked '@_implementationOnly'}}
358
466
467
+
privatevarg:ExposedProtocolPublic
468
+
privatevarh:ExposedProtocolInternal
469
+
privatevari:ExposedProtocolPrivate
470
+
privatevarj:HiddenProtocol
471
+
// expected-opt-in-error @-1 {{cannot use protocol 'HiddenProtocol' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenProtocol' is marked '@_implementationOnly'}}
472
+
359
473
@export(interface)
360
474
privatefunc privateFunc(h:HiddenLayout){}
361
475
}
@@ -381,6 +495,12 @@ internal class InternalClass: ProtocolFromDirect {
381
495
privatevarf:HiddenEnum
382
496
// expected-opt-in-error @-1 {{cannot use enum 'HiddenEnum' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenEnum' is marked '@_implementationOnly'}}
383
497
498
+
privatevarg:ExposedProtocolPublic
499
+
privatevarh:ExposedProtocolInternal
500
+
privatevari:ExposedProtocolPrivate
501
+
privatevarj:HiddenProtocol
502
+
// expected-opt-in-error @-1 {{cannot use protocol 'HiddenProtocol' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenProtocol' is marked '@_implementationOnly'}}
503
+
384
504
privatefunc privateFunc(h:HiddenLayout){} // expected-embedded-opt-in-error {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@export(interface)' because 'HiddenLayout' is marked '@_implementationOnly'}}
385
505
}
386
506
@@ -405,6 +525,12 @@ private class PrivateClass: ProtocolFromDirect {
405
525
privatevarf:HiddenEnum
406
526
// expected-opt-in-error @-1 {{cannot use enum 'HiddenEnum' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenEnum' is marked '@_implementationOnly'}}
407
527
528
+
privatevarg:ExposedProtocolPublic
529
+
privatevarh:ExposedProtocolInternal
530
+
privatevari:ExposedProtocolPrivate
531
+
privatevarj:HiddenProtocol
532
+
// expected-opt-in-error @-1 {{cannot use protocol 'HiddenProtocol' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; 'HiddenProtocol' is marked '@_implementationOnly'}}
533
+
408
534
privatefunc privateFunc(h:HiddenLayout){} // expected-embedded-opt-in-error {{struct 'HiddenLayout' cannot be used in an embedded function not marked '@export(interface)' because 'HiddenLayout' is marked '@_implementationOnly'}}
409
535
}
410
536
@@ -424,8 +550,33 @@ internal class HiddenClass: ProtocolFromDirect {
424
550
privatevard:ExposedEnumPublic
425
551
privatevare:ExposedEnumPrivate
426
552
privatevarf:HiddenEnum
553
+
554
+
privatevarg:ExposedProtocolPublic
555
+
privatevarh:ExposedProtocolInternal
556
+
privatevari:ExposedProtocolPrivate
557
+
privatevarj:HiddenProtocol
427
558
}
428
559
429
560
@_implementationOnly // expected-opt-in-error {{'@_implementationOnly' may not be used on public declarations}}
430
561
publicenumPublicHiddenClass{}
431
562
#endif
563
+
564
+
/// Protocol use sites
565
+
566
+
publicprotocolPublicProtocol:ProtocolFromDirect{
567
+
// expected-error @-1 {{cannot use protocol 'ProtocolFromDirect' here; 'directs' has been imported as implementation-only}}
0 commit comments