You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/Concurrency/isolated_captures.swift
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -39,9 +39,9 @@ class NotSendable {
39
39
letns=NotSendable(x:0)
40
40
MyActor.ns = ns
41
41
42
-
// expected-region-isolation-warning @+2 {{transferring 'ns' may cause a race}}
43
-
// expected-region-isolation-note @+1 {{transferring global actor 'MyActor'-isolated 'ns' to global actor 'YourActor'-isolated callee could cause races between global actor 'YourActor'-isolated and global actor 'MyActor'-isolated uses}}
44
42
await{@YourActorin
43
+
// expected-region-isolation-warning @+3 {{transferring 'ns' may cause a race}}
44
+
// expected-region-isolation-note @+2 {{global actor 'MyActor'-isolated 'ns' is captured by a global actor 'YourActor'-isolated closure. global actor 'YourActor'-isolated uses in closure may race against later global actor 'MyActor'-isolated uses}}
45
45
// expected-complete-warning@+1 {{capture of 'ns' with non-sendable type 'NotSendable' in an isolated closure; this is an error in the Swift 6 language mode}}
46
46
YourActor.ns = ns
47
47
}()
@@ -61,8 +61,9 @@ class NotSendable {
61
61
letns=NotSendable(x:0)
62
62
ns.stash()
63
63
64
-
// FIXME: Region isolation should diagnose this (https://github.com/apple/swift/issues/71533)
65
64
await{@YourActorin
65
+
// expected-region-isolation-warning @+3 {{transferring 'ns' may cause a race}}
66
+
// expected-region-isolation-note @+2 {{global actor 'MyActor'-isolated 'ns' is captured by a global actor 'YourActor'-isolated closure. global actor 'YourActor'-isolated uses in closure may race against later global actor 'MyActor'-isolated uses}}
66
67
// expected-complete-warning@+1 {{capture of 'ns' with non-sendable type 'NotSendable' in an isolated closure; this is an error in the Swift 6 language mode}}
67
68
YourActor.ns = ns
68
69
}()
@@ -81,8 +82,9 @@ class NotSendable {
81
82
@MyActorfunc exhibitRace3()async{
82
83
letns=NotSendable()
83
84
84
-
// FIXME: Region isolation should diagnose this (https://github.com/apple/swift/issues/71533)
85
85
await{@YourActorin
86
+
// expected-region-isolation-warning @+3 {{transferring 'ns' may cause a race}}
87
+
// expected-region-isolation-note @+2 {{global actor 'MyActor'-isolated 'ns' is captured by a global actor 'YourActor'-isolated closure. global actor 'YourActor'-isolated uses in closure may race against later global actor 'MyActor'-isolated uses}}
86
88
// expected-complete-warning@+1 {{capture of 'ns' with non-sendable type 'NotSendable' in an isolated closure; this is an error in the Swift 6 language mode}}
0 commit comments