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
fix-it regression coverage for notes suggesting 'async', '@asyncHandler' and '@GlobalActorType'
Currently, we don't have a fix-it to insert 'async', so I've marked those places
as not expecting a fix-it, until someone goes and implements that (rdar://72313654)
_ =text[0] // expected-error{{actor-isolated property 'text' can not be referenced from an '@actorIndependent' context}}
@@ -261,8 +261,8 @@ struct GenericStruct<T> {
261
261
f() // okay
262
262
}
263
263
264
-
// expected-note@+2 {{add '@asyncHandler' to function 'h()' to create an implicit asynchronous context}}
265
-
// expected-note@+1 {{add 'async' to function 'h()' to make it asynchronous}}
264
+
// expected-note@+2 {{add '@asyncHandler' to function 'h()' to create an implicit asynchronous context}} {{3-3=@asyncHandler }}
265
+
// expected-note@+1 {{add 'async' to function 'h()' to make it asynchronous}} {{none}}
266
266
@GenericGlobalActor<String>func h(){
267
267
f() // expected-error{{'async' in a function that does not support concurrency}}
268
268
_ = f // expected-error{{instance method 'f()' isolated to global actor 'GenericGlobalActor<T>' can not be referenced from different global actor 'GenericGlobalActor<String>'}}
Copy file name to clipboardExpand all lines: test/Concurrency/global_actor_from_ordinary_context.swift
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ actor class Alex {
27
27
}
28
28
29
29
30
-
// expected-note@+1 4 {{add '@SomeGlobalActor' to make global function 'referenceGlobalActor()' part of global actor 'SomeGlobalActor'}}
30
+
// expected-note@+1 4 {{add '@SomeGlobalActor' to make global function 'referenceGlobalActor()' part of global actor 'SomeGlobalActor'}} {{1-1=@SomeGlobalActor }}
31
31
func referenceGlobalActor(){
32
32
leta=Alex()
33
33
// expected-error@+1 {{instance method 'method()' isolated to global actor 'SomeGlobalActor' can not be referenced from this context}}
@@ -40,25 +40,25 @@ func referenceGlobalActor() {
40
40
}
41
41
42
42
43
-
// expected-note@+1 {{add '@SomeGlobalActor' to make global function 'referenceGlobalActor2()' part of global actor 'SomeGlobalActor'}}
43
+
// expected-note@+1 {{add '@SomeGlobalActor' to make global function 'referenceGlobalActor2()' part of global actor 'SomeGlobalActor'}} {{1-1=@SomeGlobalActor }}
44
44
func referenceGlobalActor2(){
45
45
// expected-error@+1 {{global function 'syncGlobActorFn()' isolated to global actor 'SomeGlobalActor' can not be referenced from this context}}
46
46
letx= syncGlobActorFn
47
47
x()
48
48
}
49
49
50
50
51
-
// expected-note@+2 {{add '@asyncHandler' to function 'referenceAsyncGlobalActor()' to create an implicit asynchronous context}}
52
-
// expected-note@+1 {{add 'async' to function 'referenceAsyncGlobalActor()' to make it asynchronous}}
51
+
// expected-note@+2 {{add '@asyncHandler' to function 'referenceAsyncGlobalActor()' to create an implicit asynchronous context}} {{1-1=@asyncHandler }}
52
+
// expected-note@+1 {{add 'async' to function 'referenceAsyncGlobalActor()' to make it asynchronous}} {{none}}
53
53
func referenceAsyncGlobalActor(){
54
54
lety= asyncGlobalActFn
55
55
y() // expected-error{{'async' in a function that does not support concurrency}}
56
56
}
57
57
58
58
59
-
// expected-note@+3 {{add '@asyncHandler' to function 'callGlobalActor()' to create an implicit asynchronous context}}
60
-
// expected-note@+2 {{add 'async' to function 'callGlobalActor()' to make it asynchronous}}
61
-
// expected-note@+1 {{add '@SomeGlobalActor' to make global function 'callGlobalActor()' part of global actor 'SomeGlobalActor'}}
59
+
// expected-note@+3 {{add '@asyncHandler' to function 'callGlobalActor()' to create an implicit asynchronous context}} {{1-1=@asyncHandler }}
60
+
// expected-note@+2 {{add 'async' to function 'callGlobalActor()' to make it asynchronous}} {{none}}
61
+
// expected-note@+1 {{add '@SomeGlobalActor' to make global function 'callGlobalActor()' part of global actor 'SomeGlobalActor'}} {{1-1=@SomeGlobalActor }}
62
62
func callGlobalActor(){
63
63
syncGlobActorFn() // expected-error {{'async' in a function that does not support concurrency}}
64
64
}
@@ -76,7 +76,7 @@ func fromClosure() {
76
76
}
77
77
78
78
classTaylor{
79
-
init(){ // expected-note {{add 'async' to function 'init()' to make it asynchronous}}
79
+
init(){ // expected-note {{add 'async' to function 'init()' to make it asynchronous}} {{none}}
80
80
syncGlobActorFn() // expected-error {{'async' in a function that does not support concurrency}}
81
81
82
82
// expected-error@+1 {{global function 'syncGlobActorFn()' isolated to global actor 'SomeGlobalActor' can not be referenced from this context}}
@@ -90,17 +90,17 @@ class Taylor {
90
90
_ = syncGlobActorFn
91
91
}
92
92
93
-
// expected-note@+3 2 {{add '@SomeGlobalActor' to make instance method 'method1()' part of global actor 'SomeGlobalActor'}}
94
-
// expected-note@+2 {{add '@asyncHandler' to function 'method1()' to create an implicit asynchronous context}}
95
-
// expected-note@+1 {{add 'async' to function 'method1()' to make it asynchronous}}
93
+
// expected-note@+3 2 {{add '@SomeGlobalActor' to make instance method 'method1()' part of global actor 'SomeGlobalActor'}} {{3-3=@SomeGlobalActor }}
94
+
// expected-note@+2 {{add '@asyncHandler' to function 'method1()' to create an implicit asynchronous context}} {{3-3=@asyncHandler }}
95
+
// expected-note@+1 {{add 'async' to function 'method1()' to make it asynchronous}} {{none}}
96
96
func method1(){
97
97
syncGlobActorFn() // expected-error {{'async' in a function that does not support concurrency}}
98
98
99
99
// expected-error@+1 {{global function 'syncGlobActorFn()' isolated to global actor 'SomeGlobalActor' can not be referenced from this context}}
100
100
_ = syncGlobActorFn
101
101
}
102
102
103
-
// expected-note@+2 2 {{add '@SomeGlobalActor' to make instance method 'cannotBeHandler()' part of global actor 'SomeGlobalActor'}}
103
+
// expected-note@+2 2 {{add '@SomeGlobalActor' to make instance method 'cannotBeHandler()' part of global actor 'SomeGlobalActor'}} {{3-3=@SomeGlobalActor }}
104
104
// expected-note@+1 {{add 'async' to function 'cannotBeHandler()' to make it asynchronous}}
105
105
func cannotBeHandler()->Int{
106
106
syncGlobActorFn() // expected-error {{'async' in a function that does not support concurrency}}
Copy file name to clipboardExpand all lines: test/Concurrency/global_actor_inference.swift
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -35,8 +35,8 @@ protocol P2 {
35
35
classC1:P1{
36
36
func method(){} // expected-note {{calls to instance method 'method()' from outside of its actor context are implicitly asynchronous}}
37
37
38
-
// expected-note@+2 {{add '@asyncHandler' to function 'testMethod()' to create an implicit asynchronous context}}
39
-
// expected-note@+1 {{add 'async' to function 'testMethod()' to make it asynchronous}}
38
+
// expected-note@+2 {{add '@asyncHandler' to function 'testMethod()' to create an implicit asynchronous context}} {{3-3=@asyncHandler }}
39
+
// expected-note@+1 {{add 'async' to function 'testMethod()' to make it asynchronous}} {{none}}
40
40
@OtherGlobalActorfunc testMethod(){
41
41
method() // expected-error {{'async' in a function that does not support concurrency}}
42
42
_ = method // expected-error {{instance method 'method()' isolated to global actor 'SomeGlobalActor' can not be referenced from different global actor 'OtherGlobalActor'}}
@@ -47,8 +47,8 @@ class C2: P2 {
47
47
func method1(){} // expected-note{{calls to instance method 'method1()' from outside of its actor context are implicitly asynchronous}}
48
48
func method2(){}
49
49
50
-
// expected-note@+2 {{add '@asyncHandler' to function 'testMethod()' to create an implicit asynchronous context}}
51
-
// expected-note@+1 {{add 'async' to function 'testMethod()' to make it asynchronous}}
50
+
// expected-note@+2 {{add '@asyncHandler' to function 'testMethod()' to create an implicit asynchronous context}} {{3-3=@asyncHandler }}
51
+
// expected-note@+1 {{add 'async' to function 'testMethod()' to make it asynchronous}} {{none}}
52
52
@OtherGlobalActorfunc testMethod(){
53
53
method1() // expected-error{{'async' in a function that does not support concurrency}}
54
54
_ = method1 // expected-error{{instance method 'method1()' isolated to global actor 'SomeGlobalActor' can not be referenced from different global actor 'OtherGlobalActor'}}
@@ -83,8 +83,8 @@ class C5 {
83
83
func method2(){} // expected-note {{calls to instance method 'method2()' from outside of its actor context are implicitly asynchronous}}
84
84
}
85
85
86
-
// expected-note@+2 5 {{add '@asyncHandler' to function 'testGlobalActorInference(c3:c4:c5:)' to create an implicit asynchronous context}}
87
-
// expected-note@+1 5 {{add 'async' to function 'testGlobalActorInference(c3:c4:c5:)' to make it asynchronous}}
86
+
// expected-note@+2 5 {{add '@asyncHandler' to function 'testGlobalActorInference(c3:c4:c5:)' to create an implicit asynchronous context}} {{1-1=@asyncHandler }}
87
+
// expected-note@+1 5 {{add 'async' to function 'testGlobalActorInference(c3:c4:c5:)' to make it asynchronous}} {{none}}
c3.method1() // expected-error{{'async' in a function that does not support concurrency}}
@@ -145,8 +145,8 @@ actor class GenericSub<T> : GenericSuper<[T]> {
145
145
@GenericGlobalActor<T>overridefunc method2(){} // expected-error{{global actor 'GenericGlobalActor<T>'-isolated instance method 'method2()' has different actor isolation from global actor 'GenericGlobalActor<[T]>'-isolated overridden declaration}}
146
146
@actorIndependentoverridefunc method3(){} // expected-error{{actor-independent instance method 'method3()' has different actor isolation from global actor 'GenericGlobalActor<[T]>'-isolated overridden declaration}}
147
147
148
-
// expected-note@+2 {{add '@asyncHandler' to function 'testMethod()' to create an implicit asynchronous context}}
149
-
// expected-note@+1 {{add 'async' to function 'testMethod()' to make it asynchronous}}
148
+
// expected-note@+2 {{add '@asyncHandler' to function 'testMethod()' to create an implicit asynchronous context}} {{3-3=@asyncHandler }}
149
+
// expected-note@+1 {{add 'async' to function 'testMethod()' to make it asynchronous}} {{none}}
150
150
@OtherGlobalActorfunc testMethod(){
151
151
method() // expected-error{{'async' in a function that does not support concurrency}}
152
152
_ = method // expected-error{{instance method 'method()' isolated to global actor 'GenericGlobalActor<[T]>' can not be referenced from different global actor 'OtherGlobalActor'}}
@@ -190,9 +190,9 @@ func bar() async {
190
190
foo() // expected-error{{call is 'async' but is not marked with 'await'}}
191
191
}
192
192
193
-
// expected-note@+3 {{add '@SomeGlobalActor' to make global function 'barSync()' part of global actor 'SomeGlobalActor'}}
194
-
// expected-note@+2 {{add '@asyncHandler' to function 'barSync()' to create an implicit asynchronous context}}
195
-
// expected-note@+1 {{add 'async' to function 'barSync()' to make it asynchronous}}
193
+
// expected-note@+3 {{add '@SomeGlobalActor' to make global function 'barSync()' part of global actor 'SomeGlobalActor'}} {{1-1=@SomeGlobalActor }}
194
+
// expected-note@+2 {{add '@asyncHandler' to function 'barSync()' to create an implicit asynchronous context}} {{1-1=@asyncHandler }}
195
+
// expected-note@+1 {{add 'async' to function 'barSync()' to make it asynchronous}} {{none}}
196
196
func barSync(){
197
197
foo() // expected-error {{'async' in a function that does not support concurrency}}
0 commit comments