88@execution ( concurrent) @execution ( caller) func mutipleAttrs( ) async { }
99// expected-error@-1 {{duplicate attribute}} expected-note@-1 {{attribute already specified here}}
1010
11+ do {
12+ @execution ( caller) struct S { }
13+ // expected-error@-1 {{'@execution(caller)' attribute cannot be applied to this declaration}}
14+
15+ func f( @execution ( caller) param: Int ) { }
16+ // expected-error@-1 {{'@execution(caller)' attribute cannot be applied to this declaration}}
17+ }
18+
1119@execution ( concurrent) func nonAsync1( ) { }
1220// expected-error@-1 {{cannot use '@execution' on non-async global function 'nonAsync1()'}}
1321
@@ -27,16 +35,29 @@ struct Test {
2735
2836 @execution ( concurrent) func member( ) async { } // Ok
2937
30- // expected-error@+1 {{'@execution(caller)' attribute cannot be applied to this declaration}}
31- @execution ( caller) subscript( a: Int ) -> Bool {
38+ @execution ( concurrent) var syncP : Int {
39+ // expected-error@-1 {{cannot use '@execution' on non-async property 'syncP'}}
40+ get { }
41+ }
42+ @execution ( concurrent) var asyncP : Int {
43+ get async { }
44+ }
45+
46+ // expected-error@+1 {{cannot use '@execution' on non-async subscript 'subscript(sync:)'}}
47+ @execution ( caller) subscript( sync _: Int ) -> Bool {
3248 @execution ( concurrent) get { false }
3349 // expected-error@-1 {{@execution(concurrent)' attribute cannot be applied to this declaration}}
3450 @execution ( concurrent) set { }
3551 // expected-error@-1 {{@execution(concurrent)' attribute cannot be applied to this declaration}}
3652 }
53+ @execution ( caller) subscript( async _: Int ) -> Bool {
54+ get async { }
55+ }
3756
38- @execution ( caller) var x : Int
39- // expected-error@-1 {{'@execution(caller)' attribute cannot be applied to this declaration}}
57+ @execution ( caller) var storedVar : Int
58+ // expected-error@-1 {{'@execution(caller)' must not be used on stored properties}}
59+ @execution ( caller) let storedLet : Int
60+ // expected-error@-1 {{'@execution(caller)' must not be used on stored properties}}
4061}
4162
4263do {
4869
4970do {
5071 @execution ( caller) func local( ) async { } // Ok
72+
73+ protocol P {
74+ @execution ( caller) var syncP : Int { get }
75+ // expected-error@-1 {{cannot use '@execution' on non-async property 'syncP'}}
76+
77+ @execution ( caller) var asyncP : Int { get async }
78+ }
5179}
5280
5381struct TestAttributeCollisions {
5482 @execution ( concurrent) nonisolated func testNonIsolated( ) async { }
5583
5684 @execution ( concurrent) func test( arg: isolated MainActor) async { }
5785 // expected-error@-1 {{cannot use '@execution' on instance method 'test(arg:)' because it has an isolated parameter: 'arg'}}
86+ @execution ( concurrent) subscript( test arg: isolated MainActor) -> Int {
87+ // expected-error@-1 {{cannot use '@execution' on subscript 'subscript(test:)' because it has an isolated parameter: 'arg'}}
88+ get async { }
89+ }
5890
5991 @execution ( concurrent) func testIsolationAny( arg: @isolated ( any) ( ) -> Void ) async { }
6092 // expected-error@-1 {{cannot use '@execution' on instance method 'testIsolationAny(arg:)' because it has a dynamically isolated parameter: 'arg'}}
93+ @execution ( concurrent) subscript( testIsolationAny arg: @isolated ( any) ( ) -> Void ) -> Int {
94+ // expected-error@-1 {{cannot use '@execution' on subscript 'subscript(testIsolationAny:)' because it has a dynamically isolated parameter: 'arg'}}
95+ get async { }
96+ }
6197
6298 @MainActor @execution ( concurrent) func testGlobalActor( ) async { }
6399 // expected-warning @-1 {{instance method 'testGlobalActor()' has multiple actor-isolation attributes ('MainActor' and 'execution(concurrent)')}}
0 commit comments