|
39 | 39 | }
|
40 | 40 |
|
41 | 41 | protocol P {
|
42 |
| - // FIXME: Not diagnosed |
| 42 | + init(sync: ()) |
| 43 | + @execution(concurrent) init(executionAsync: ()) async |
| 44 | + @MainActor init(mainActorAsync: ()) async |
| 45 | + // expected-warning@+1:5 {{feature 'AsyncCallerExecution' will cause nonisolated async initializer 'init' to run on the caller's actor; use @execution(concurrent) to preserve behavior}}{{5-5=@execution(concurrent) }}{{none}} |
| 46 | + init(async: ()) async |
| 47 | + |
| 48 | + func syncF() |
| 49 | + @execution(concurrent) func executionAsyncF() async |
| 50 | + @MainActor func mainActorAsyncF() async |
| 51 | + // expected-warning@+1:10 {{feature 'AsyncCallerExecution' will cause nonisolated async instance method 'asyncF' to run on the caller's actor; use @execution(concurrent) to preserve behavior}}{{5-5=@execution(concurrent) }}{{none}} |
43 | 52 | func asyncF() async
|
44 | 53 | }
|
45 | 54 | }
|
| 55 | +protocol Functions {} |
| 56 | +extension Functions { |
| 57 | + init(sync: ()) {} |
| 58 | + @execution(concurrent) init(executionAsync: ()) async {} |
| 59 | + @MainActor init(mainActorAsync: ()) async {} |
| 60 | + // expected-warning@+1:3 {{feature 'AsyncCallerExecution' will cause nonisolated async initializer 'init' to run on the caller's actor; use @execution(concurrent) to preserve behavior}}{{3-3=@execution(concurrent) }}{{none}} |
| 61 | + init(async: ()) async {} |
| 62 | + |
| 63 | + func syncF() {} |
| 64 | + @execution(concurrent) func executionAsyncF() async {} |
| 65 | + @MainActor func mainActorAsyncF() async {} |
| 66 | + // expected-warning@+1:8 {{feature 'AsyncCallerExecution' will cause nonisolated async instance method 'asyncF' to run on the caller's actor; use @execution(concurrent) to preserve behavior}}{{3-3=@execution(concurrent) }}{{none}} |
| 67 | + func asyncF() async {} |
| 68 | +} |
46 | 69 |
|
47 | 70 | // MARK: Storage
|
48 | 71 | do {
|
@@ -81,10 +104,31 @@ do {
|
81 | 104 |
|
82 | 105 | // expected-warning@+1:23 {{feature 'AsyncCallerExecution' will cause nonisolated async getter for property 'asyncS' to run on the caller's actor; use @execution(concurrent) to preserve behavior}}{{5-5=@execution(concurrent) }}{{none}}
|
83 | 106 | var asyncS: Int { get async }
|
84 |
| - // FIXME: Not diagnosed |
| 107 | + // expected-warning@+1:39 {{feature 'AsyncCallerExecution' will cause nonisolated async getter for subscript 'subscript' to run on the caller's actor; use @execution(concurrent) to preserve behavior}}{{5-5=@execution(concurrent) }}{{none}} |
85 | 108 | subscript(asyncS _: Int) -> Int { get async }
|
86 | 109 | }
|
87 | 110 | }
|
| 111 | +protocol Storage {} |
| 112 | +extension Storage { |
| 113 | + var syncS: Int { get {} set {} } |
| 114 | + subscript(syncS _: Int) -> Int { get {} } |
| 115 | + |
| 116 | + @execution(concurrent) var executionAsyncS: Int { get async {} } |
| 117 | + @execution(concurrent) subscript(executionAsyncS _: Int) -> Int { get async {} } |
| 118 | + |
| 119 | + @MainActor var mainActorAsyncS: Int { get async {} } |
| 120 | + @MainActor subscript(mainActorAsyncS _: Int) -> Int { get async {} } |
| 121 | +
|
| 122 | + // expected-warning@+2:5 {{feature 'AsyncCallerExecution' will cause nonisolated async getter for property 'asyncS' to run on the caller's actor; use @execution(concurrent) to preserve behavior}}{{-1:3-3=@execution(concurrent) }}{{none}} |
| 123 | + var asyncS: Int { |
| 124 | + get async {} |
| 125 | + } |
| 126 | + // expected-warning@+2:5 {{feature 'AsyncCallerExecution' will cause nonisolated async getter for subscript 'subscript' to run on the caller's actor; use @execution(concurrent) to preserve behavior}}{{-1:3-3=@execution(concurrent) }}{{none}} |
| 127 | + subscript(asyncS _: Int) -> Int { |
| 128 | + get async throws {} |
| 129 | + } |
| 130 | +} |
| 131 | + |
88 | 132 |
|
89 | 133 | // MARK: Parameters
|
90 | 134 | do {
|
|
0 commit comments