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(
3979
3979
3980
3980
// Sendable can only be used in the same source file.
3981
3981
auto conformanceDecl = conformanceDC->getAsDecl ();
3982
- auto behavior = SendableCheckContext (conformanceDC)
3982
+ auto behavior = SendableCheckContext (conformanceDC, check )
3983
3983
.defaultDiagnosticBehavior ();
3984
3984
if (conformanceDC->getParentSourceFile () &&
3985
- nominal->getParentSourceFile () &&
3986
3985
conformanceDC->getParentSourceFile () != nominal->getParentSourceFile ()) {
3987
3986
conformanceDecl->diagnose (diag::concurrent_value_outside_source_file,
3988
3987
nominal->getDescriptiveKind (),
Original file line number Diff line number Diff line change 1
1
public class NonStrictClass { }
2
+
3
+ public struct NonStrictStruct { }
Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ actor A10: AsyncThrowingProtocolWithNotSendable {
147
147
}
148
148
149
149
// rdar://86653457 - Crash due to missing Sendable conformances.
150
+ // expected-warning@+1{{non-final class 'Klass' cannot conform to 'Sendable'; use '@unchecked Sendable'}}
150
151
class Klass < Output: Sendable > : Sendable { }
151
152
final class SubKlass : Klass < [ S ] > { }
152
153
public struct S { }
Original file line number Diff line number Diff line change @@ -17,3 +17,5 @@ func testA(a: A) async {
17
17
// CHECK: note: struct 'StrictStruct' does not conform to the 'Sendable' protocol
18
18
// CHECK: note: class 'NonStrictClass' does not conform to the 'Sendable' protocol
19
19
}
20
+
21
+ extension NonStrictStruct : @unchecked Sendable { }
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ actor A7 {
44
44
@available ( SwiftStdlib 5 . 1 , * )
45
45
class C1 : Actor {
46
46
// 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'}}
47
48
nonisolated var unownedExecutor : UnownedSerialExecutor {
48
49
fatalError ( " " )
49
50
}
@@ -52,6 +53,7 @@ class C1: Actor {
52
53
@available ( SwiftStdlib 5 . 1 , * )
53
54
class C2 : Actor {
54
55
// 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'}}
55
57
// FIXME: this should be an isolation violation
56
58
var unownedExecutor : UnownedSerialExecutor {
57
59
fatalError ( " " )
@@ -62,6 +64,7 @@ class C2: Actor {
62
64
class C3 : Actor {
63
65
// expected-error@-1{{type 'C3' does not conform to protocol 'Actor'}}
64
66
// 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'}}
65
68
nonisolated func enqueue( _ job: UnownedJob ) { }
66
69
}
67
70
You can’t perform that action at this time.
0 commit comments