|
2 | 2 |
|
3 | 3 | // REQUIRES: concurrency
|
4 | 4 |
|
| 5 | +@available(SwiftStdlib 5.1, *) |
5 | 6 | @globalActor
|
6 | 7 | private struct PrivateGA { // expected-note 2 {{type declared here}}
|
7 | 8 | actor Actor {}
|
8 | 9 | static let shared = Actor()
|
9 | 10 | }
|
10 | 11 |
|
| 12 | +@available(SwiftStdlib 5.1, *) |
11 | 13 | @globalActor
|
12 | 14 | internal struct InternalGA { // expected-note {{type declared here}}
|
13 | 15 | actor Actor {}
|
14 | 16 | static let shared = Actor()
|
15 | 17 | }
|
16 | 18 |
|
17 |
| -@globalActor @usableFromInline |
| 19 | +@available(SwiftStdlib 5.1, *) |
| 20 | +@globalActor |
| 21 | +@usableFromInline |
18 | 22 | internal struct UFIGA {
|
19 | 23 | @usableFromInline actor Actor {}
|
20 | 24 | @usableFromInline static let shared = Actor()
|
21 | 25 | }
|
22 | 26 |
|
| 27 | +@available(SwiftStdlib 5.1, *) |
23 | 28 | @globalActor
|
24 | 29 | public struct PublicGA {
|
25 | 30 | public actor Actor {}
|
26 | 31 | public static let shared = Actor()
|
27 | 32 | }
|
28 | 33 |
|
29 |
| -// expected-error@+1 {{internal struct 'UFIStructPrivateGA' cannot have private global actor 'PrivateGA'}} |
| 34 | +// expected-error@+2 {{internal struct 'UFIStructPrivateGA' cannot have private global actor 'PrivateGA'}} |
| 35 | +@available(SwiftStdlib 5.1, *) |
30 | 36 | @PrivateGA @usableFromInline internal struct UFIStructPrivateGA {} // expected-error {{global actor for struct 'UFIStructPrivateGA' must be '@usableFromInline' or public}}
|
| 37 | +@available(SwiftStdlib 5.1, *) |
31 | 38 | @InternalGA @usableFromInline internal struct UFIStructInternalGA {} // expected-error {{global actor for struct 'UFIStructInternalGA' must be '@usableFromInline' or public}}
|
| 39 | +@available(SwiftStdlib 5.1, *) |
32 | 40 | @UFIGA @usableFromInline internal struct UFIStructUFIGA {}
|
| 41 | +@available(SwiftStdlib 5.1, *) |
33 | 42 | @PublicGA @usableFromInline internal struct UFIStructPublicGA {}
|
| 43 | + |
| 44 | +@available(SwiftStdlib 5.1, *) |
| 45 | +@inlinable public func testNestedFuncs() { |
| 46 | + // FIXME: Functions isolated to non-resilient global actors nested in |
| 47 | + // inlinable functions should be diagnosed. |
| 48 | + @PrivateGA func inlineFuncPrivateGA() {} |
| 49 | + @InternalGA func inlineFuncInternalGA() {} |
| 50 | + @UFIGA func inlineFuncUFIGA() {} |
| 51 | + @PublicGA func inlineFuncPublicGA() {} |
| 52 | +} |
| 53 | + |
| 54 | +@available(SwiftStdlib 5.1, *) |
| 55 | +@inlinable public func testNestedClosures() { |
| 56 | + // FIXME: Closures isolated to non-resilient global actors nested in |
| 57 | + // inlinable functions should be diagnosed. |
| 58 | + _ = { @PrivateGA in } |
| 59 | + _ = { @InternalGA in } |
| 60 | + _ = { @UFIGA in } |
| 61 | + _ = { @PublicGA in } |
| 62 | +} |
0 commit comments