55
66func doSomething( ) { }
77
8- // expected-note @+1 6 {{calls to global function 'requiresMainActor()' from outside of its actor context are implicitly asynchronous}}
8+ // expected-note @+1 4 {{calls to global function 'requiresMainActor()' from outside of its actor context are implicitly asynchronous}}
99@MainActor func requiresMainActor( ) { }
1010
1111@MainActor func testNonDefer_positive( ) {
@@ -66,7 +66,7 @@ func testGlobalActorAsync_negative() async {
6666
6767@available ( SwiftStdlib 5 . 1 , * )
6868actor Actor {
69- // expected-note @+1 6 {{mutation of this property is only permitted within the actor}}
69+ // expected-note @+1 3 {{mutation of this property is only permitted within the actor}}
7070 var actorProperty = 0
7171
7272 func testActor_positive( ) {
@@ -76,13 +76,6 @@ actor Actor {
7676 doSomething ( )
7777 }
7878
79- func testActor_task_positive( ) {
80- Task {
81- defer { actorProperty += 1 }
82- doSomething ( )
83- }
84- }
85-
8679#if NEGATIVES
8780 nonisolated func testActor_negative( ) {
8881 defer {
@@ -91,30 +84,13 @@ actor Actor {
9184 }
9285 doSomething ( )
9386 }
94-
95- nonisolated func testActor_task_negative( ) {
96- Task {
97- // expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a non-isolated context}}
98- defer { actorProperty += 1 }
99- doSomething ( )
100- }
101- }
102-
10387 @MainActor func testActor_negative_globalActor( ) {
10488 defer {
10589 // expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from the main actor}}
10690 actorProperty += 1
10791 }
10892 doSomething ( )
10993 }
110-
111- func testActor_task_negative_globalActor( ) {
112- Task { @MainActor in
113- // expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from the main actor}}
114- defer { actorProperty += 1 }
115- doSomething ( )
116- }
117- }
11894#endif
11995
12096 @MainActor func testGlobalActor_positive( ) {
@@ -123,13 +99,6 @@ actor Actor {
12399 }
124100 doSomething ( )
125101 }
126-
127- func testGlobalActor_task_positive( ) {
128- Task { @MainActor in
129- defer { requiresMainActor ( ) }
130- doSomething ( )
131- }
132- }
133102
134103#if NEGATIVES
135104 func testGlobalActor_negative( ) {
@@ -139,14 +108,6 @@ actor Actor {
139108 }
140109 doSomething ( )
141110 }
142-
143- func testGlobalActor_task_negative( ) {
144- Task {
145- // expected-error @+1 {{call to main actor-isolated global function 'requiresMainActor()' in a synchronous nonisolated context}}
146- defer { requiresMainActor ( ) }
147- doSomething ( )
148- }
149- }
150111#endif
151112}
152113
@@ -169,48 +130,3 @@ func testIsolatedActor_negative(actor: Actor) {
169130 doSomething ( )
170131}
171132#endif
172-
173- @available ( SwiftStdlib 5 . 1 , * )
174- func testGlobalActor_inTask_positive( ) {
175- Task { @MainActor in
176- defer { requiresMainActor ( ) }
177- doSomething ( )
178- }
179- }
180-
181- #if NEGATIVES
182- @available ( SwiftStdlib 5 . 1 , * )
183- func testGlobalActor_inTask_negative( ) {
184- Task {
185- // expected-error @+1 {{call to main actor-isolated global function 'requiresMainActor()' in a synchronous nonisolated context}}
186- defer { requiresMainActor ( ) }
187- doSomething ( )
188- }
189- }
190- #endif
191-
192- @available ( SwiftStdlib 5 . 1 , * )
193- func takeClosureWithIsolatedParam( body: ( isolated Actor) -> Void ) { }
194-
195- @available ( SwiftStdlib 5 . 1 , * )
196- func takeClosureWithNotIsolatedParam( body: ( Actor ) -> Void ) { }
197-
198- @available ( SwiftStdlib 5 . 1 , * )
199- func testIsolatedActor_closure_positive( ) {
200- takeClosureWithIsolatedParam { actor in
201- actor . actorProperty += 1
202- defer { actor . actorProperty += 1 }
203- doSomething ( )
204- }
205- }
206-
207- #if NEGATIVES
208- @available ( SwiftStdlib 5 . 1 , * )
209- func testIsolatedActor_closure_negative( ) {
210- takeClosureWithNotIsolatedParam { actor in
211- // expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a non-isolated context}}
212- defer { actor . actorProperty += 1 }
213- doSomething ( )
214- }
215- }
216- #endif
0 commit comments