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
@@ -1282,8 +1282,14 @@ actor Counter {
1282
1282
classC2{}
1283
1283
1284
1284
@SomeGlobalActor
1285
-
classC3:C2{}
1286
-
// 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}}
1285
+
classC3:C2{ // expected-note {{class 'C3' does not conform to the 'Sendable' protocol}}
1286
+
func requireSendableSelf(){
1287
+
Task.detached{
1288
+
_ =self
1289
+
// 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}}
1290
+
}
1291
+
}
1292
+
}
1287
1293
1288
1294
@GenericGlobalActor<U>
1289
1295
classGenericSuper<U>{}
@@ -1463,7 +1469,6 @@ class None {
1463
1469
// try to add inferred isolation while overriding
1464
1470
@MainActor
1465
1471
classMA_None1:None{
1466
-
// 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}}
1467
1472
1468
1473
// FIXME: bad note, since the problem is a mismatch in overridden vs inferred isolation; this wont help.
1469
1474
// expected-note@+1 {{add '@MainActor' to make instance method 'method()' part of global actor 'MainActor'}}
@@ -1494,7 +1499,6 @@ class None_MADirect: MADirect {
1494
1499
1495
1500
@SomeGlobalActor
1496
1501
classSGA_MADirect:MADirect{
1497
-
// 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}}
1498
1502
1499
1503
// 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