Skip to content

Commit 14ced21

Browse files
committed
[Concurrency] Update tests for downgraded warning.
1 parent 8c0a18d commit 14ced21

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

test/Concurrency/actor_isolation.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ extension MyActor {
325325
acceptInout(&self.mutable) // expected-error{{actor-isolated property 'mutable' can not be used 'inout' from a Sendable closure}}
326326
_ = self.immutable
327327
_ = self.synchronous() // expected-error{{call to actor-isolated instance method 'synchronous()' in a synchronous nonisolated context}}
328-
_ = localVar // expected-error{{reference to captured var 'localVar' in concurrently-executing code}}
329-
localVar = 25 // expected-error{{mutation of captured var 'localVar' in concurrently-executing code}}
328+
_ = localVar // expected-warning{{reference to captured var 'localVar' in concurrently-executing code}}
329+
localVar = 25 // expected-warning{{mutation of captured var 'localVar' in concurrently-executing code}}
330330
_ = localConstant
331331

332332
_ = otherLocalVar
@@ -357,17 +357,17 @@ extension MyActor {
357357
@Sendable func localFn1() {
358358
_ = self.text[0] // expected-error{{actor-isolated property 'text' can not be referenced from a Sendable function}}
359359
_ = self.synchronous() // expected-error{{call to actor-isolated instance method 'synchronous()' in a synchronous nonisolated context}}
360-
_ = localVar // expected-error{{reference to captured var 'localVar' in concurrently-executing code}}
361-
localVar = 25 // expected-error{{mutation of captured var 'localVar' in concurrently-executing code}}
360+
_ = localVar // expected-warning{{reference to captured var 'localVar' in concurrently-executing code}}
361+
localVar = 25 // expected-warning{{mutation of captured var 'localVar' in concurrently-executing code}}
362362
_ = localConstant
363363
}
364364

365365
@Sendable func localFn2() {
366366
acceptClosure {
367367
_ = text[0] // expected-error{{actor-isolated property 'text' can not be referenced from a non-isolated context}}
368368
_ = self.synchronous() // expected-error{{call to actor-isolated instance method 'synchronous()' in a synchronous nonisolated context}}
369-
_ = localVar // expected-error{{reference to captured var 'localVar' in concurrently-executing code}}
370-
localVar = 25 // expected-error{{mutation of captured var 'localVar' in concurrently-executing code}}
369+
_ = localVar // expected-warning{{reference to captured var 'localVar' in concurrently-executing code}}
370+
localVar = 25 // expected-warning{{mutation of captured var 'localVar' in concurrently-executing code}}
371371
_ = localConstant
372372
}
373373
}
@@ -640,8 +640,8 @@ func testGlobalRestrictions(actor: MyActor) async {
640640
// code.
641641
var i = 17
642642
acceptConcurrentClosure {
643-
_ = i // expected-error{{reference to captured var 'i' in concurrently-executing code}}
644-
i = 42 // expected-error{{mutation of captured var 'i' in concurrently-executing code}}
643+
_ = i // expected-warning{{reference to captured var 'i' in concurrently-executing code}}
644+
i = 42 // expected-warning{{mutation of captured var 'i' in concurrently-executing code}}
645645
}
646646
print(i)
647647

@@ -738,7 +738,7 @@ func checkLocalFunctions() async {
738738
}
739739

740740
func local3() { // expected-warning{{concurrently-executed local function 'local3()' must be marked as '@Sendable'}}
741-
k = 25 // expected-error{{mutation of captured var 'k' in concurrently-executing code}}
741+
k = 25 // expected-warning{{mutation of captured var 'k' in concurrently-executing code}}
742742
}
743743

744744
print(k)
@@ -1158,12 +1158,12 @@ extension MyActor {
11581158
_ = synchronous() // expected-error{{expression is 'async' but is not marked with 'await'}}
11591159
// expected-note@-1{{calls to instance method 'synchronous()' from outside of its actor context are implicitly asynchronous}}
11601160

1161-
counter += 1 // expected-error{{mutation of captured var 'counter' in concurrently-executing code}}
1161+
counter += 1 // expected-warning{{mutation of captured var 'counter' in concurrently-executing code}}
11621162
}
11631163

11641164
acceptAsyncSendableClosure {
11651165
_ = await synchronous() // ok
1166-
counter += 1 // expected-error{{mutation of captured var 'counter' in concurrently-executing code}}
1166+
counter += 1 // expected-warning{{mutation of captured var 'counter' in concurrently-executing code}}
11671167
}
11681168

11691169
acceptAsyncSendableClosureInheriting {
@@ -1184,7 +1184,7 @@ func testGlobalActorInheritance() {
11841184
var counter = 0
11851185

11861186
acceptAsyncSendableClosure {
1187-
counter += 1 // expected-error{{mutation of captured var 'counter' in concurrently-executing code}}
1187+
counter += 1 // expected-warning{{mutation of captured var 'counter' in concurrently-executing code}}
11881188
}
11891189

11901190
acceptAsyncSendableClosure { @SomeGlobalActor in

test/Concurrency/async_let_isolation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ actor MyActor {
2121
async let z = synchronous()
2222

2323
var localText = text
24-
async let w = localText.removeLast() // expected-error{{mutation of captured var 'localText' in concurrently-executing code}}
24+
async let w = localText.removeLast() // expected-warning{{mutation of captured var 'localText' in concurrently-executing code}}
2525

2626
_ = await x
2727
_ = await y

test/Concurrency/concurrent_value_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func testConcurrency() {
188188
acceptConcurrent {
189189
print(x) // expected-warning{{capture of 'x' with non-sendable type 'NotConcurrent' in a `@Sendable` closure}}
190190
print(y) // expected-warning{{capture of 'y' with non-sendable type 'NotConcurrent' in a `@Sendable` closure}}
191-
// expected-error@-1{{reference to captured var 'y' in concurrently-executing code}}
191+
// expected-warning@-1{{reference to captured var 'y' in concurrently-executing code}}
192192
}
193193
}
194194

test/attr/attr_concurrent.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ func mutationOfLocal() {
8484
}()
8585

8686
// Mutations of captured variables executing concurrently are bad.
87-
localInt = 17 // expected-error{{mutation of captured var 'localInt' in concurrently-executing code}}
88-
localInt += 1 // expected-error{{mutation of captured var 'localInt' in concurrently-executing code}}
89-
localInt.makeNegative() // expected-error{{mutation of captured var 'localInt' in concurrently-executing code}}
87+
localInt = 17 // expected-warning{{mutation of captured var 'localInt' in concurrently-executing code}}
88+
localInt += 1 // expected-warning{{mutation of captured var 'localInt' in concurrently-executing code}}
89+
localInt.makeNegative() // expected-warning{{mutation of captured var 'localInt' in concurrently-executing code}}
9090

9191
_ = {
92-
localInt = localInt + 12 // expected-error{{mutation of captured var 'localInt' in concurrently-executing code}}
92+
localInt = localInt + 12 // expected-warning{{mutation of captured var 'localInt' in concurrently-executing code}}
9393
}()
9494

9595
return i + localInt
@@ -114,8 +114,8 @@ func testCaseNonTrivialValue() {
114114
print(i.optArray?[j] ?? 0)
115115
print(i.optArray![j])
116116

117-
i.int = 5 // expected-error{{mutation of captured var 'i' in concurrently-executing code}}
118-
i.array[0] = 5 // expected-error{{mutation of captured var 'i' in concurrently-executing code}}
117+
i.int = 5 // expected-warning{{mutation of captured var 'i' in concurrently-executing code}}
118+
i.array[0] = 5 // expected-warning{{mutation of captured var 'i' in concurrently-executing code}}
119119

120120
return value
121121
}

0 commit comments

Comments
 (0)