Skip to content

Commit df2844d

Browse files
committed
[concurrency] Cleanup verify-additional-prefix usage in tests.
This includes a bunch of fixes. It is not exhaustive but fit my time boxed time period I set aside to look at this today. A quick non-exhaustive list: 1. I removed unnecessary verify-additional-prefix lines. 2. Split tests with typechecker error and non-typechecker error components. 3. Removed complete- lines that we used when testing w/without send non sednable. 4. Translated complete-and-tns- lines to be just complete- since they are just testing strict-concurrency=complete and we are not testing complete without send non sendable anymore.
1 parent 335c551 commit df2844d

24 files changed

+1641
-1270
lines changed

test/Concurrency/actor_inout_isolation.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -verify-additional-prefix minimal-
2-
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -verify-additional-prefix targeted-complete-tns- -verify-additional-prefix complete-tns- -strict-concurrency=complete
2+
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -verify-additional-prefix complete- -strict-concurrency=complete
33

44
// REQUIRES: concurrency
55
// REQUIRES: asserts
@@ -100,7 +100,7 @@ extension TestActor {
100100
// external class method call
101101
@available(SwiftStdlib 5.1, *)
102102
class NonAsyncClass {
103-
// expected-targeted-complete-tns-note @-1 {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
103+
// expected-complete-note @-1 {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
104104
// expected-tns-note @-2 {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
105105
func modifyOtherAsync(_ other : inout Int) async {
106106
// ...
@@ -119,7 +119,7 @@ extension TestActor {
119119
func passStateIntoDifferentClassMethod() async {
120120
let other = NonAsyncClass()
121121
let otherCurry = other.modifyOtherAsync
122-
// expected-targeted-complete-tns-warning @-1 {{non-Sendable type 'NonAsyncClass' cannot exit actor-isolated context in call to nonisolated instance method 'modifyOtherAsync'}}
122+
// expected-complete-warning @-1 {{non-Sendable type 'NonAsyncClass' cannot exit actor-isolated context in call to nonisolated instance method 'modifyOtherAsync'}}
123123
await other.modifyOtherAsync(&value2)
124124
// expected-error @-1 {{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}
125125

@@ -212,22 +212,22 @@ struct MyGlobalActor {
212212
// expected-note @-1 {{var declared here}}
213213
// expected-note @-2 {{var declared here}}
214214
// expected-note @-3 {{mutation of this var is only permitted within the actor}}
215-
// expected-complete-tns-error @-4 {{top-level code variables cannot have a global actor}}
216-
// expected-complete-tns-note @-5 4{{mutation of this var is only permitted within the actor}}
215+
// expected-complete-error @-4 {{top-level code variables cannot have a global actor}}
216+
// expected-complete-note @-5 4{{mutation of this var is only permitted within the actor}}
217217

218218

219219
if #available(SwiftStdlib 5.1, *) {
220220
let _ = Task.detached { await { (_ foo: inout Int) async in foo += 1 }(&number) }
221221
// expected-error @-1 {{actor-isolated var 'number' cannot be passed 'inout' to 'async' function call}}
222222
// expected-minimal-error @-2 {{global actor 'MyGlobalActor'-isolated var 'number' can not be used 'inout' from a nonisolated context}}
223-
// expected-complete-tns-error @-3 {{main actor-isolated var 'number' can not be used 'inout' from a nonisolated context}}
223+
// expected-complete-error @-3 {{main actor-isolated var 'number' can not be used 'inout' from a nonisolated context}}
224224
}
225225

226226
// attempt to pass global state owned by the global actor to another async function
227227
@available(SwiftStdlib 5.1, *)
228228
@MyGlobalActor func sneaky() async { await modifyAsynchronously(&number) }
229229
// expected-error @-1 {{actor-isolated var 'number' cannot be passed 'inout' to 'async' function call}}
230-
// expected-complete-tns-error @-2 {{main actor-isolated var 'number' can not be used 'inout' from global actor 'MyGlobalActor'}}
230+
// expected-complete-error @-2 {{main actor-isolated var 'number' can not be used 'inout' from global actor 'MyGlobalActor'}}
231231

232232

233233
// It's okay to pass actor state inout to synchronous functions!
@@ -237,13 +237,13 @@ func globalSyncFunction(_ foo: inout Int) { }
237237
@MyGlobalActor func globalActorSyncFunction(_ foo: inout Int) { }
238238
@available(SwiftStdlib 5.1, *)
239239
@MyGlobalActor func globalActorAsyncOkay() async { globalActorSyncFunction(&number) }
240-
// expected-complete-tns-error @-1 {{main actor-isolated var 'number' can not be used 'inout' from global actor 'MyGlobalActor'}}
240+
// expected-complete-error @-1 {{main actor-isolated var 'number' can not be used 'inout' from global actor 'MyGlobalActor'}}
241241
@available(SwiftStdlib 5.1, *)
242242
@MyGlobalActor func globalActorAsyncOkay2() async { globalSyncFunction(&number) }
243-
// expected-complete-tns-error @-1 {{main actor-isolated var 'number' can not be used 'inout' from global actor 'MyGlobalActor'}}
243+
// expected-complete-error @-1 {{main actor-isolated var 'number' can not be used 'inout' from global actor 'MyGlobalActor'}}
244244
@available(SwiftStdlib 5.1, *)
245245
@MyGlobalActor func globalActorSyncOkay() { globalSyncFunction(&number) }
246-
// expected-complete-tns-error @-1 {{main actor-isolated var 'number' can not be used 'inout' from global actor 'MyGlobalActor'}}
246+
// expected-complete-error @-1 {{main actor-isolated var 'number' can not be used 'inout' from global actor 'MyGlobalActor'}}
247247

248248
// Gently unwrap things that are fine
249249
@available(SwiftStdlib 5.1, *)
@@ -288,11 +288,11 @@ actor ProtectArray {
288288
func test() async {
289289
// FIXME: this is invalid too!
290290
_ = await array.mutateAsynchronously
291-
// expected-targeted-complete-tns-warning@-1 {{non-Sendable type '@lvalue [Int]' cannot exit actor-isolated context in call to nonisolated property 'mutateAsynchronously'}}
291+
// expected-complete-warning@-1 {{non-Sendable type '@lvalue [Int]' cannot exit actor-isolated context in call to nonisolated property 'mutateAsynchronously'}}
292292

293293
_ = await array[mutateAsynchronously: 0]
294294
// expected-error@-1 {{actor-isolated property 'array' cannot be passed 'inout' to 'async' function call}}
295-
// expected-targeted-complete-tns-warning@-2 {{non-Sendable type 'inout Array<Int>' cannot exit actor-isolated context in call to nonisolated subscript 'subscript(mutateAsynchronously:)'}}
295+
// expected-complete-warning@-2 {{non-Sendable type 'inout Array<Int>' cannot exit actor-isolated context in call to nonisolated subscript 'subscript(mutateAsynchronously:)'}}
296296

297297
await passToAsync(array[0])
298298

test/Concurrency/actor_isolation_unsafe.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify
22
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
3-
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -verify-additional-prefix complete-tns- -strict-concurrency=complete
3+
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -verify-additional-prefix complete- -strict-concurrency=complete
44

55
// REQUIRES: concurrency
66

@@ -14,7 +14,7 @@ actor SomeGlobalActor {
1414

1515
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
1616
@SomeGlobalActor(unsafe) func globalSome() { } // expected-note 2{{calls to global function 'globalSome()' from outside of its actor context are implicitly asynchronous}}
17-
// expected-complete-tns-note @-1 {{calls to global function 'globalSome()' from outside of its actor context are implicitly asynchronous}}
17+
// expected-complete-note @-1 {{calls to global function 'globalSome()' from outside of its actor context are implicitly asynchronous}}
1818

1919
// ----------------------------------------------------------------------
2020
// Witnessing and unsafe global actor
@@ -56,15 +56,15 @@ struct S4_P1: P1 {
5656
@MainActor(unsafe)
5757
protocol P2 {
5858
func f() // expected-note{{calls to instance method 'f()' from outside of its actor context are implicitly asynchronous}}
59-
// expected-complete-tns-note @-1 {{calls to instance method 'f()' from outside of its actor context are implicitly asynchronous}}
59+
// expected-complete-note @-1 {{calls to instance method 'f()' from outside of its actor context are implicitly asynchronous}}
6060
nonisolated func g()
6161
}
6262

6363
struct S5_P2: P2 {
6464
func f() { } // expected-note{{calls to instance method 'f()' from outside of its actor context are implicitly asynchronous}}
6565
// expected-note@-1 {{main actor isolation inferred from conformance to protocol 'P2'}}
66-
// expected-complete-tns-note @-2 {{calls to instance method 'f()' from outside of its actor context are implicitly asynchronous}}
67-
// expected-complete-tns-note @-3 {{main actor isolation inferred from conformance to protocol 'P2'}}}
66+
// expected-complete-note @-2 {{calls to instance method 'f()' from outside of its actor context are implicitly asynchronous}}
67+
// expected-complete-note @-3 {{main actor isolation inferred from conformance to protocol 'P2'}}}
6868
func g() { }
6969
}
7070

@@ -76,12 +76,12 @@ nonisolated func testP2(x: S5_P2, p2: P2) {
7676
}
7777

7878
func testP2_noconcurrency(x: S5_P2, p2: P2) {
79-
// expected-complete-tns-note @-1 2{{add '@MainActor' to make global function 'testP2_noconcurrency(x:p2:)' part of global actor 'MainActor'}}
79+
// expected-complete-note @-1 2{{add '@MainActor' to make global function 'testP2_noconcurrency(x:p2:)' part of global actor 'MainActor'}}
8080
p2.f() // okay without complete. with targeted/minimal not concurrency-related code.
81-
// expected-complete-tns-warning @-1 {{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
81+
// expected-complete-warning @-1 {{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
8282
p2.g() // okay
8383
x.f() // okay without complete. with targeted/minimal not concurrency-related code
84-
// expected-complete-tns-warning @-1 {{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
84+
// expected-complete-warning @-1 {{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
8585
x.g() // OKAY
8686
}
8787

@@ -96,7 +96,7 @@ class C1 {
9696
class C2: C1 {
9797
override func method() { // expected-note 2{{overridden declaration is here}}
9898
globalSome() // okay when not in complete
99-
// expected-complete-tns-warning @-1 {{call to global actor 'SomeGlobalActor'-isolated global function 'globalSome()' in a synchronous main actor-isolated context}}
99+
// expected-complete-warning @-1 {{call to global actor 'SomeGlobalActor'-isolated global function 'globalSome()' in a synchronous main actor-isolated context}}
100100
}
101101
}
102102

test/Concurrency/async_initializer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -enable-experimental-concurrency -target %target-swift-5.1-abi-triple -emit-sil -o /dev/null -verify %s
22
// RUN: %target-swift-frontend -enable-experimental-concurrency -target %target-swift-5.1-abi-triple -emit-sil -o /dev/null -verify -strict-concurrency=targeted %s
3-
// RUN: %target-swift-frontend -enable-experimental-concurrency -target %target-swift-5.1-abi-triple -emit-sil -o /dev/null -verify -strict-concurrency=complete %s -verify-additional-prefix complete-and-tns-
3+
// RUN: %target-swift-frontend -enable-experimental-concurrency -target %target-swift-5.1-abi-triple -emit-sil -o /dev/null -verify -strict-concurrency=complete %s -verify-additional-prefix complete-
44

55
// REQUIRES: concurrency
66

@@ -115,11 +115,11 @@ struct SomeStruct {
115115
@MainActor(unsafe) init(asyncMainActorUnsafe: Int) async {}
116116

117117
// expected-warning@+2 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
118-
// expected-complete-and-tns-note@+1 {{calls to initializer 'init(mainActorUnsafe:)' from outside of its actor context are implicitly asynchronous}}
118+
// expected-complete-note@+1 {{calls to initializer 'init(mainActorUnsafe:)' from outside of its actor context are implicitly asynchronous}}
119119
@MainActor(unsafe) init(mainActorUnsafe: Int) {}
120120
}
121121

122-
// expected-complete-and-tns-note @+3 {{add '@MainActor' to make global function 'globActorTest1()' part of global actor 'MainActor'}}
122+
// expected-complete-note @+3 {{add '@MainActor' to make global function 'globActorTest1()' part of global actor 'MainActor'}}
123123
// expected-note @+2 {{add '@MainActor' to make global function 'globActorTest1()' part of global actor 'MainActor'}}
124124
// expected-note @+1 2 {{add 'async' to function 'globActorTest1()' to make it asynchronous}}
125125
func globActorTest1() {
@@ -129,7 +129,7 @@ func globActorTest1() {
129129

130130
_ = SomeStruct(asyncMainActorUnsafe: 0) // expected-error {{'async' call in a function that does not support concurrency}}
131131

132-
_ = SomeStruct(mainActorUnsafe: 0) // expected-complete-and-tns-warning {{call to main actor-isolated initializer 'init(mainActorUnsafe:)' in a synchronous nonisolated context}}
132+
_ = SomeStruct(mainActorUnsafe: 0) // expected-complete-warning {{call to main actor-isolated initializer 'init(mainActorUnsafe:)' in a synchronous nonisolated context}}
133133
}
134134

135135
func globActorTestAsyncEdition() async {

test/Concurrency/async_let_isolation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -verify-additional-prefix without-transferring-
66

77
// Then strict-concurrency with everything.
8-
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix tns-
8+
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
99

1010
// REQUIRES: concurrency
1111
// REQUIRES: asserts

test/Concurrency/async_task_groups.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify
22
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
3-
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix tns-
3+
// RUN: %target-swift-frontend -target %target-swift-5.1-abi-triple %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
44

55
// REQUIRES: concurrency
66
// REQUIRES: asserts

test/Concurrency/async_tasks.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -strict-concurrency=targeted -target %target-swift-5.1-abi-triple %s -o /dev/null -verify -emit-sil -DALLOW_TYPECHECKER_ERRORS -verify-additional-prefix typechecker-
22
// RUN: %target-swift-frontend -strict-concurrency=complete -target %target-swift-5.1-abi-triple %s -o /dev/null -verify -emit-sil -DALLOW_TYPECHECKER_ERRORS -verify-additional-prefix typechecker-
3-
// RUN: %target-swift-frontend -strict-concurrency=complete -target %target-swift-5.1-abi-triple %s -o /dev/null -verify -emit-sil -verify-additional-prefix tns-
3+
// RUN: %target-swift-frontend -strict-concurrency=complete -target %target-swift-5.1-abi-triple %s -o /dev/null -verify -emit-sil -verify-additional-prefix complete-
44

55
// REQUIRES: concurrency
66
// REQUIRES: asserts
@@ -140,9 +140,9 @@ func test_detached_throwing() async -> String {
140140

141141
// ==== Detached Tasks with inout Params---------------------------------------
142142
@available(SwiftStdlib 5.1, *)
143-
func printOrderNumber(n: inout Int) async { // expected-tns-note {{parameter 'n' is declared 'inout'}}
144-
Task.detached { // expected-tns-error {{escaping closure captures 'inout' parameter 'n'}}
145-
n+=1 // expected-tns-note {{captured here}}
146-
print(n) // expected-tns-note {{captured here}}
143+
func printOrderNumber(n: inout Int) async { // expected-complete-note {{parameter 'n' is declared 'inout'}}
144+
Task.detached { // expected-complete-error {{escaping closure captures 'inout' parameter 'n'}}
145+
n+=1 // expected-complete-note {{captured here}}
146+
print(n) // expected-complete-note {{captured here}}
147147
}
148148
}

0 commit comments

Comments
 (0)