Skip to content

Commit 7fe100a

Browse files
committed
[region-isolation] Clean up the named value transfer warning.
1 parent eeba791 commit 7fe100a

8 files changed

+47
-47
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ NOTE(regionbasedisolation_isolated_since_in_same_region_basename, none,
971971
//
972972

973973
ERROR(regionbasedisolation_named_transfer_yields_race, none,
974-
"transferring non-Sendable value %0 could yield races with later accesses",
974+
"transferring %0 could cause a race",
975975
(Identifier))
976976
NOTE(regionbasedisolation_named_info_transfer_yields_race, none,
977977
"%0 is transferred from %1 caller to %2 callee. Later uses in caller could race with potential uses in callee",

test/Concurrency/experimental_feature_strictconcurrency.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func iterate(stream: AsyncStream<Int>) async {
3131
// FIXME: Region isolation should consider a value from a 'nonisolated(unsafe)'
3232
// declaration to be in a disconnected region
3333

34-
// expected-region-isolation-warning @+3 {{transferring non-Sendable value 'it' could yield races with later accesses}}
34+
// expected-region-isolation-warning @+3 {{transferring 'it' could cause a race}}
3535
// expected-region-isolation-note @+2 {{'it' is transferred from main actor-isolated caller to nonisolated callee. Later uses in caller could race with potential uses in callee}}
3636
// expected-region-isolation-note @+1 {{access here could race}}
3737
while let element = await it.next() {

test/Concurrency/sendable_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func testNonSendableBaseArg() async {
273273
let t = NonSendable() // expected-tns-note {{variable defined here}}
274274
await t.update()
275275
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
276-
// expected-tns-warning @-2 {{transferring non-Sendable value 't' could yield races with later accesses}}
276+
// expected-tns-warning @-2 {{transferring 't' could cause a race}}
277277
// expected-tns-note @-3 {{'t' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
278278

279279
_ = await t.x

test/Concurrency/transfernonsendable.swift

Lines changed: 30 additions & 30 deletions
Large diffs are not rendered by default.

test/Concurrency/transfernonsendable_global_actor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private struct StructContainingValue { // expected-complete-note 2{{}}
104104
var x = StructContainingValue() // expected-tns-note {{variable defined here}}
105105
x = StructContainingValue()
106106

107-
await transferToNonIsolated(x) // expected-tns-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
107+
await transferToNonIsolated(x) // expected-tns-warning {{transferring 'x' could cause a race}}
108108
// expected-tns-note @-1 {{'x' is transferred from global actor 'GlobalActor'-isolated caller to nonisolated callee. Later uses in caller could race with potential uses in callee}}
109109
// expected-complete-warning @-2 {{passing argument of non-sendable type 'StructContainingValue' outside of global actor 'GlobalActor'-isolated context may introduce data races}}
110110

test/Concurrency/transfernonsendable_region_based_sendability.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ func test_indirect_regions(a : A, b : Bool) async {
353353
}
354354

355355
if (b) {
356-
await a.foo(ns5_0) // expected-tns-warning {{transferring non-Sendable value 'ns5_0' could yield races with later accesses}}
356+
await a.foo(ns5_0) // expected-tns-warning {{transferring 'ns5_0' could cause a race}}
357357
// expected-tns-note @-1 {{'ns5_0' is transferred from nonisolated caller to actor-isolated callee. Later uses in caller could race with potential uses in callee}}
358358
// expected-complete-warning @-2 {{passing argument of non-sendable type 'Any' into actor-isolated context may introduce data races}}
359359

@@ -363,7 +363,7 @@ func test_indirect_regions(a : A, b : Bool) async {
363363
print(ns5_1) // expected-tns-note {{access here could race}}
364364
}
365365
} else {
366-
await a.foo(ns5_1) // expected-tns-warning {{transferring non-Sendable value 'ns5_1' could yield races with later accesses}}
366+
await a.foo(ns5_1) // expected-tns-warning {{transferring 'ns5_1' could cause a race}}
367367
// expected-tns-note @-1 {{'ns5_1' is transferred from nonisolated caller to actor-isolated callee. Later uses in caller could race with potential uses in callee}}
368368
// expected-complete-warning @-2 {{passing argument of non-sendable type 'Any' into actor-isolated context may introduce data races}}
369369

test/Concurrency/transfernonsendable_strong_transferring_params.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ func testTransferringParameter_canTransfer(_ x: transferring Klass, _ y: Klass)
9393

9494
func testTransferringParameter_cannotTransferTwice(_ x: transferring Klass, _ y: Klass) async {
9595
// expected-note @-1:54 {{variable defined here}}
96-
await transferToMain(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
96+
await transferToMain(x) // expected-warning {{transferring 'x' could cause a race}}
9797
// expected-note @-1 {{'x' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
9898
await transferToMain(x) // expected-note {{access here could race}}
9999
}
100100

101101
func testTransferringParameter_cannotUseAfterTransfer(_ x: transferring Klass, _ y: Klass) async {
102102
// expected-note @-1 {{variable defined here}}
103-
await transferToMain(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
103+
await transferToMain(x) // expected-warning {{transferring 'x' could cause a race}}
104104
// expected-note @-1 {{'x' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
105105
useValue(x) // expected-note {{access here could race}}
106106
}
@@ -116,14 +116,14 @@ actor MyActor {
116116

117117
func getNormalErrorIfTransferTwice(_ x: transferring Klass) async {
118118
// expected-note @-1 {{variable defined here}}
119-
await transferToMain(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
119+
await transferToMain(x) // expected-warning {{transferring 'x' could cause a race}}
120120
// expected-note @-1 {{'x' is transferred from actor-isolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
121121
await transferToMain(x) // expected-note {{access here could race}}
122122
}
123123

124124
func getNormalErrorIfUseAfterTransfer(_ x: transferring Klass) async {
125125
// expected-note @-1 {{variable defined here}}
126-
await transferToMain(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
126+
await transferToMain(x) // expected-warning {{transferring 'x' could cause a race}}
127127
// expected-note @-1 {{'x' is transferred from actor-isolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
128128
useValue(x) // expected-note {{access here could race}}
129129
}
@@ -163,7 +163,7 @@ func canTransferAssigningIntoLocal(_ x: transferring Klass) async {
163163
func canTransferAssigningIntoLocal2(_ x: transferring Klass) async {
164164
// expected-note @-1 {{variable defined here}}
165165
let _ = x
166-
await transferToMain(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
166+
await transferToMain(x) // expected-warning {{transferring 'x' could cause a race}}
167167
// expected-note @-1 {{'x' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
168168
let _ = x // expected-note {{access here could race}}
169169
}
@@ -226,7 +226,7 @@ func canTransferAfterAssignButUseIsError(_ x: transferring Any) async {
226226
x = y
227227

228228
// TODO: This should refer to the transferring parameter.
229-
await transferToMain(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
229+
await transferToMain(x) // expected-warning {{transferring 'x' could cause a race}}
230230
// expected-note @-1 {{'x' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
231231

232232
useValue(x) // expected-note {{access here could race}}
@@ -256,7 +256,7 @@ func mergeDoesNotEliminateEarlierTransfer(_ x: transferring NonSendableStruct) a
256256
useValue(x)
257257

258258
// Transfer x
259-
await transferToMain(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
259+
await transferToMain(x) // expected-warning {{transferring 'x' could cause a race}}
260260
// expected-note @-1 {{'x' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
261261

262262
// y is assigned into a field of x, so we treat this like a merge.
@@ -274,7 +274,7 @@ func mergeDoesNotEliminateEarlierTransfer2(_ x: transferring NonSendableStruct)
274274
useValue(x)
275275

276276
// Transfer x
277-
await transferToMain(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
277+
await transferToMain(x) // expected-warning {{transferring 'x' could cause a race}}
278278
// expected-note @-1 {{'x' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
279279

280280
// y is assigned into a field of x, so we treat this like a merge.

test/Concurrency/transfernonsendable_strong_transferring_results.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func simpleTest() async {
6868
func simpleTest2() async {
6969
let x = NonSendableKlass() // expected-note {{variable defined here}}
7070
let y = transferResultWithArg(x)
71-
await transferToMainDirect(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
71+
await transferToMainDirect(x) // expected-warning {{transferring 'x' could cause a race}}
7272
// expected-note @-1 {{'x' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
7373
useValue(y)
7474
useValue(x) // expected-note {{access here could race}}
@@ -79,14 +79,14 @@ func simpleTest3() async {
7979
let x = NonSendableKlass()
8080
let y = transferResultWithArg(x) // expected-note {{variable defined here}}
8181
await transferToMainDirect(x)
82-
await transferToMainDirect(y) // expected-warning {{transferring non-Sendable value 'y' could yield races with later accesses}}
82+
await transferToMainDirect(y) // expected-warning {{transferring 'y' could cause a race}}
8383
// expected-note @-1 {{'y' is transferred from nonisolated caller to main actor-isolated callee}}
8484
useValue(y) // expected-note {{access here could race}}
8585
}
8686

8787
func transferResult() async -> transferring NonSendableKlass {
8888
let x = NonSendableKlass() // expected-note {{variable defined here}}
89-
await transferToMainDirect(x) // expected-warning {{transferring non-Sendable value 'x' could yield races with later accesses}}
89+
await transferToMainDirect(x) // expected-warning {{transferring 'x' could cause a race}}
9090
// expected-note @-1 {{'x' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
9191
return x // expected-note {{access here could race}}
9292
}

0 commit comments

Comments
 (0)