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
Copy file name to clipboardExpand all lines: test/Concurrency/actor_isolation_unsafe.swift
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -11,15 +11,18 @@ actor SomeGlobalActor {
11
11
staticletshared=SomeGlobalActor()
12
12
}
13
13
14
+
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
14
15
@MainActor(unsafe)func globalMain(){} // expected-note {{calls to global function 'globalMain()' from outside of its actor context are implicitly asynchronous}}
15
16
17
+
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
16
18
@SomeGlobalActor(unsafe)func globalSome(){} // expected-note 2{{calls to global function 'globalSome()' from outside of its actor context are implicitly asynchronous}}
17
19
// expected-complete-tns-note @-1 {{calls to global function 'globalSome()' from outside of its actor context are implicitly asynchronous}}
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
23
26
@MainActor(unsafe)func onMainActor() // expected-note 2{{mark the protocol requirement 'onMainActor()' 'async' to allow actor-isolated conformances}}
24
27
}
25
28
@@ -45,7 +48,7 @@ struct S4_P1: P1 {
45
48
@SomeGlobalActorfunc onMainActor(){} // expected-warning{{global actor 'SomeGlobalActor'-isolated instance method 'onMainActor()' cannot be used to satisfy main actor-isolated protocol requirement}}
46
49
}
47
50
48
-
51
+
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
49
52
@MainActor(unsafe)
50
53
protocolP2{
51
54
func f() // expected-note{{calls to instance method 'f()' from outside of its actor context are implicitly asynchronous}}
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
83
87
@MainActor(unsafe)func method(){} // expected-note{{overridden declaration is here}}
84
88
}
85
89
@@ -114,12 +118,14 @@ class C6: C2 {
114
118
}
115
119
116
120
classC7:C2{
121
+
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
117
122
@SomeGlobalActor(unsafe)overridefunc method(){ // expected-error{{global actor 'SomeGlobalActor'-isolated instance method 'method()' has different actor isolation from main actor-isolated overridden declaration}}
118
123
globalMain() // expected-warning{{call to main actor-isolated global function 'globalMain()' in a synchronous global actor 'SomeGlobalActor'-isolated context}}
119
124
globalSome() // okay
120
125
}
121
126
}
122
127
128
+
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
123
129
@MainActor(unsafe) // expected-note {{'GloballyIsolatedProto' is isolated to global actor 'MainActor' here}}
Copy file name to clipboardExpand all lines: test/Concurrency/async_initializer.swift
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -112,8 +112,13 @@ enum E {
112
112
structSomeStruct{
113
113
@MainActorinit(asyncMainActor:Int)async{}
114
114
@MainActorinit(mainActor:Int){} // expected-note {{calls to initializer 'init(mainActor:)' from outside of its actor context are implicitly asynchronous}}
115
+
116
+
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
@MainActor(unsafe)init(mainActorUnsafe:Int){} // expected-complete-and-tns-note {{calls to initializer 'init(mainActorUnsafe:)' from outside of its actor context are implicitly asynchronous}}
118
+
119
+
// expected-warning@+2 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
120
+
// expected-complete-and-tns-note@+1 {{calls to initializer 'init(mainActorUnsafe:)' from outside of its actor context are implicitly asynchronous}}
121
+
@MainActor(unsafe)init(mainActorUnsafe:Int){}
117
122
}
118
123
119
124
// expected-complete-and-tns-note @+3 {{add '@MainActor' to make global function 'globActorTest1()' part of global actor 'MainActor'}}
@OtherGlobalActorfunc onOtherGlobalActor()->Int{5} // expected-note{{calls to global function 'onOtherGlobalActor()' from outside of its actor context are implicitly asynchronous}}
34
-
@OtherGlobalActor(unsafe)func onOtherGlobalActorUnsafe()->Int{5} // expected-note 2{{calls to global function 'onOtherGlobalActorUnsafe()' from outside of its actor context are implicitly asynchronous}}
34
+
@preconcurrency@OtherGlobalActorfunc onOtherGlobalActorUnsafe()->Int{5} // expected-note 2{{calls to global function 'onOtherGlobalActorUnsafe()' from outside of its actor context are implicitly asynchronous}}
35
35
// expected-complete-tns-note @-1 {{calls to global function 'onOtherGlobalActorUnsafe()' from outside of its actor context are implicitly asynchronous}}
@SomeGlobalActor(unsafe)func req() // expected-note{{calls to instance method 'req()' from outside of its actor context are implicitly asynchronous}}
507
+
@preconcurrency@SomeGlobalActorfunc req() // expected-note{{calls to instance method 'req()' from outside of its actor context are implicitly asynchronous}}
0 commit comments