5
5
6
6
func doSomething( ) { }
7
7
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}}
9
9
@MainActor func requiresMainActor( ) { }
10
10
11
11
@MainActor func testNonDefer_positive( ) {
@@ -66,7 +66,7 @@ func testGlobalActorAsync_negative() async {
66
66
67
67
@available ( SwiftStdlib 5 . 1 , * )
68
68
actor 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}}
70
70
var actorProperty = 0
71
71
72
72
func testActor_positive( ) {
@@ -76,13 +76,6 @@ actor Actor {
76
76
doSomething ( )
77
77
}
78
78
79
- func testActor_task_positive( ) {
80
- Task {
81
- defer { actorProperty += 1 }
82
- doSomething ( )
83
- }
84
- }
85
-
86
79
#if NEGATIVES
87
80
nonisolated func testActor_negative( ) {
88
81
defer {
@@ -91,30 +84,13 @@ actor Actor {
91
84
}
92
85
doSomething ( )
93
86
}
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
-
103
87
@MainActor func testActor_negative_globalActor( ) {
104
88
defer {
105
89
// expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from the main actor}}
106
90
actorProperty += 1
107
91
}
108
92
doSomething ( )
109
93
}
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
- }
118
94
#endif
119
95
120
96
@MainActor func testGlobalActor_positive( ) {
@@ -123,13 +99,6 @@ actor Actor {
123
99
}
124
100
doSomething ( )
125
101
}
126
-
127
- func testGlobalActor_task_positive( ) {
128
- Task { @MainActor in
129
- defer { requiresMainActor ( ) }
130
- doSomething ( )
131
- }
132
- }
133
102
134
103
#if NEGATIVES
135
104
func testGlobalActor_negative( ) {
@@ -139,14 +108,6 @@ actor Actor {
139
108
}
140
109
doSomething ( )
141
110
}
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
- }
150
111
#endif
151
112
}
152
113
@@ -169,48 +130,3 @@ func testIsolatedActor_negative(actor: Actor) {
169
130
doSomething ( )
170
131
}
171
132
#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