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/actor_isolation.swift
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1467,3 +1467,22 @@ class SGA_MADirect: MADirect {
1467
1467
// directly-nonisolated vs overridden-MainActor = nonisolated
1468
1468
nonisolatedoverridefunc method2(){beets_ma()} // expected-error {{call to main actor-isolated global function 'beets_ma()' in a synchronous nonisolated context}}
1469
1469
}
1470
+
1471
+
// Actor isolation allows capture
1472
+
extensionMyActor{
1473
+
func testNonSendableCaptures(sc:SomeClass){
1474
+
Task{
1475
+
_ =self
1476
+
_ = sc
1477
+
1478
+
Task{[sc,self]in
1479
+
_ =self
1480
+
_ = sc
1481
+
1482
+
Task{
1483
+
_ = sc // expected-warning{{capture of 'sc' with non-sendable type 'SomeClass' in a `@Sendable` closure}}
0 commit comments