@@ -309,8 +309,8 @@ extension MyActor {
309
309
acceptInout ( & self . mutable) // expected-error{{actor-isolated property 'mutable' can not be used 'inout' from a Sendable closure}}
310
310
_ = self . immutable
311
311
_ = self . synchronous ( ) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a Sendable closure}}
312
- _ = localVar // expected-error {{reference to captured var 'localVar' in concurrently-executing code}}
313
- localVar = 25 // expected-error {{mutation of captured var 'localVar' in concurrently-executing code}}
312
+ _ = localVar // expected-warning {{reference to captured var 'localVar' in concurrently-executing code}}
313
+ localVar = 25 // expected-warning {{mutation of captured var 'localVar' in concurrently-executing code}}
314
314
_ = localConstant
315
315
316
316
_ = otherLocalVar
@@ -341,17 +341,17 @@ extension MyActor {
341
341
@Sendable func localFn1( ) {
342
342
_ = self . text [ 0 ] // expected-error{{actor-isolated property 'text' can not be referenced from a Sendable function}}
343
343
_ = self . synchronous ( ) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a Sendable function}}
344
- _ = localVar // expected-error {{reference to captured var 'localVar' in concurrently-executing code}}
345
- localVar = 25 // expected-error {{mutation of captured var 'localVar' in concurrently-executing code}}
344
+ _ = localVar // expected-warning {{reference to captured var 'localVar' in concurrently-executing code}}
345
+ localVar = 25 // expected-warning {{mutation of captured var 'localVar' in concurrently-executing code}}
346
346
_ = localConstant
347
347
}
348
348
349
349
@Sendable func localFn2( ) {
350
350
acceptClosure {
351
351
_ = text [ 0 ] // expected-error{{actor-isolated property 'text' can not be referenced from a non-isolated context}}
352
352
_ = self . synchronous ( ) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a non-isolated context}}
353
- _ = localVar // expected-error {{reference to captured var 'localVar' in concurrently-executing code}}
354
- localVar = 25 // expected-error {{mutation of captured var 'localVar' in concurrently-executing code}}
353
+ _ = localVar // expected-warning {{reference to captured var 'localVar' in concurrently-executing code}}
354
+ localVar = 25 // expected-warning {{mutation of captured var 'localVar' in concurrently-executing code}}
355
355
_ = localConstant
356
356
}
357
357
}
@@ -624,8 +624,8 @@ func testGlobalRestrictions(actor: MyActor) async {
624
624
// code.
625
625
var i = 17
626
626
acceptConcurrentClosure {
627
- _ = i // expected-error {{reference to captured var 'i' in concurrently-executing code}}
628
- i = 42 // expected-error {{mutation of captured var 'i' in concurrently-executing code}}
627
+ _ = i // expected-warning {{reference to captured var 'i' in concurrently-executing code}}
628
+ i = 42 // expected-warning {{mutation of captured var 'i' in concurrently-executing code}}
629
629
}
630
630
print ( i)
631
631
@@ -722,7 +722,7 @@ func checkLocalFunctions() async {
722
722
}
723
723
724
724
func local3( ) { // expected-error{{concurrently-executed local function 'local3()' must be marked as '@Sendable'}}
725
- k = 25 // expected-error {{mutation of captured var 'k' in concurrently-executing code}}
725
+ k = 25 // expected-warning {{mutation of captured var 'k' in concurrently-executing code}}
726
726
}
727
727
728
728
print ( k)
@@ -1141,12 +1141,12 @@ extension MyActor {
1141
1141
_ = synchronous ( ) // expected-error{{expression is 'async' but is not marked with 'await'}}
1142
1142
// expected-note@-1{{calls to instance method 'synchronous()' from outside of its actor context are implicitly asynchronous}}
1143
1143
1144
- counter += 1 // expected-error {{mutation of captured var 'counter' in concurrently-executing code}}
1144
+ counter += 1 // expected-warning {{mutation of captured var 'counter' in concurrently-executing code}}
1145
1145
}
1146
1146
1147
1147
acceptAsyncSendableClosure {
1148
1148
_ = await synchronous ( ) // ok
1149
- counter += 1 // expected-error {{mutation of captured var 'counter' in concurrently-executing code}}
1149
+ counter += 1 // expected-warning {{mutation of captured var 'counter' in concurrently-executing code}}
1150
1150
}
1151
1151
1152
1152
acceptAsyncSendableClosureInheriting {
@@ -1167,14 +1167,13 @@ func testGlobalActorInheritance() {
1167
1167
var counter = 0
1168
1168
1169
1169
acceptAsyncSendableClosure {
1170
- counter += 1 // expected-error {{mutation of captured var 'counter' in concurrently-executing code}}
1170
+ counter += 1 // expected-warning {{mutation of captured var 'counter' in concurrently-executing code}}
1171
1171
}
1172
1172
1173
1173
acceptAsyncSendableClosure { @SomeGlobalActor in
1174
1174
counter += 1 // ok
1175
1175
}
1176
1176
1177
-
1178
1177
acceptAsyncSendableClosureInheriting {
1179
1178
counter += 1 // ok
1180
1179
}
0 commit comments