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
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1308,8 +1308,14 @@ actor Counter {
1308
1308
classC2{}
1309
1309
1310
1310
@SomeGlobalActor
1311
-
classC3:C2{}
1312
-
// expected-warning@-1 {{global actor 'SomeGlobalActor'-isolated class 'C3' has different actor isolation from nonisolated superclass 'C2'; this is an error in the Swift 6 language mode}}
1311
+
classC3:C2{ // expected-note {{class 'C3' does not conform to the 'Sendable' protocol}}
1312
+
func requireSendableSelf(){
1313
+
Task.detached{
1314
+
_ =self
1315
+
// expected-warning@-1 {{capture of 'self' with non-sendable type 'C3' in a `@Sendable` closure; this is an error in the Swift 6 language mode}}
1316
+
}
1317
+
}
1318
+
}
1313
1319
1314
1320
@GenericGlobalActor<U>
1315
1321
classGenericSuper<U>{}
@@ -1489,7 +1495,6 @@ class None {
1489
1495
// try to add inferred isolation while overriding
1490
1496
@MainActor
1491
1497
classMA_None1:None{
1492
-
// expected-warning@-1 {{main actor-isolated class 'MA_None1' has different actor isolation from nonisolated superclass 'None'; this is an error in the Swift 6 language mode}}
1493
1498
1494
1499
// FIXME: bad note, since the problem is a mismatch in overridden vs inferred isolation; this wont help.
1495
1500
// expected-note@+1 {{add '@MainActor' to make instance method 'method()' part of global actor 'MainActor'}}
@@ -1520,7 +1525,6 @@ class None_MADirect: MADirect {
1520
1525
1521
1526
@SomeGlobalActor
1522
1527
classSGA_MADirect:MADirect{
1523
-
// expected-warning@-1 {{global actor 'SomeGlobalActor'-isolated class 'SGA_MADirect' has different actor isolation from nonisolated superclass 'MADirect'; this is an error in the Swift 6 language mode}}
1524
1528
1525
1529
// inferred-SomeGlobalActor vs overridden-MainActor = mainactor
// expected-warning@-1 {{global actor 'GenericGlobalActor<String>'-isolated class 'SubclassWithGlobalActors' has different actor isolation from nonisolated superclass 'SuperclassWithGlobalActors'; this is an error in the Swift 6 language mode}}
252
-
253
251
overridefunc f(){} // okay: inferred to @GenericGlobalActor<Int>
254
252
255
253
@GenericGlobalActor<String>overridefunc g(){} // expected-error{{global actor 'GenericGlobalActor<String>'-isolated instance method 'g()' has different actor isolation from global actor 'GenericGlobalActor<Int>'-isolated overridden declaration}}
0 commit comments