File tree Expand file tree Collapse file tree 5 files changed +9
-2
lines changed
Expand file tree Collapse file tree 5 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -3979,10 +3979,9 @@ bool swift::checkSendableConformance(
39793979
39803980 // Sendable can only be used in the same source file.
39813981 auto conformanceDecl = conformanceDC->getAsDecl ();
3982- auto behavior = SendableCheckContext (conformanceDC)
3982+ auto behavior = SendableCheckContext (conformanceDC, check )
39833983 .defaultDiagnosticBehavior ();
39843984 if (conformanceDC->getParentSourceFile () &&
3985- nominal->getParentSourceFile () &&
39863985 conformanceDC->getParentSourceFile () != nominal->getParentSourceFile ()) {
39873986 conformanceDecl->diagnose (diag::concurrent_value_outside_source_file,
39883987 nominal->getDescriptiveKind (),
Original file line number Diff line number Diff line change 11public class NonStrictClass { }
2+
3+ public struct NonStrictStruct { }
Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ actor A10: AsyncThrowingProtocolWithNotSendable {
147147}
148148
149149// rdar://86653457 - Crash due to missing Sendable conformances.
150+ // expected-warning@+1{{non-final class 'Klass' cannot conform to 'Sendable'; use '@unchecked Sendable'}}
150151class Klass < Output: Sendable > : Sendable { }
151152final class SubKlass : Klass < [ S ] > { }
152153public struct S { }
Original file line number Diff line number Diff line change @@ -17,3 +17,5 @@ func testA(a: A) async {
1717 // CHECK: note: struct 'StrictStruct' does not conform to the 'Sendable' protocol
1818 // CHECK: note: class 'NonStrictClass' does not conform to the 'Sendable' protocol
1919}
20+
21+ extension NonStrictStruct : @unchecked Sendable { }
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ actor A7 {
4444@available ( SwiftStdlib 5 . 1 , * )
4545class C1 : Actor {
4646 // expected-error@-1{{non-actor type 'C1' cannot conform to the 'Actor' protocol}}
47+ // expected-warning@-2{{non-final class 'C1' cannot conform to 'Sendable'; use '@unchecked Sendable'}}
4748 nonisolated var unownedExecutor : UnownedSerialExecutor {
4849 fatalError ( " " )
4950 }
@@ -52,6 +53,7 @@ class C1: Actor {
5253@available ( SwiftStdlib 5 . 1 , * )
5354class C2 : Actor {
5455 // expected-error@-1{{non-actor type 'C2' cannot conform to the 'Actor' protocol}}
56+ // expected-warning@-2{{non-final class 'C2' cannot conform to 'Sendable'; use '@unchecked Sendable'}}
5557 // FIXME: this should be an isolation violation
5658 var unownedExecutor : UnownedSerialExecutor {
5759 fatalError ( " " )
@@ -62,6 +64,7 @@ class C2: Actor {
6264class C3 : Actor {
6365 // expected-error@-1{{type 'C3' does not conform to protocol 'Actor'}}
6466 // expected-error@-2{{non-actor type 'C3' cannot conform to the 'Actor' protocol}}
67+ // expected-warning@-3{{non-final class 'C3' cannot conform to 'Sendable'; use '@unchecked Sendable'}}
6568 nonisolated func enqueue( _ job: UnownedJob ) { }
6669}
6770
You can’t perform that action at this time.
0 commit comments