@@ -8,7 +8,7 @@ struct NS1 { }
8
8
@available ( SwiftStdlib 5 . 1 , * )
9
9
@available ( * , unavailable)
10
10
extension NS1 : Sendable { }
11
- // expected-note@-1 2 {{conformance of 'NS1' to 'Sendable' has been explicitly marked unavailable here}}
11
+ // expected-note@-1 4 {{conformance of 'NS1' to 'Sendable' has been explicitly marked unavailable here}}
12
12
13
13
@available ( SwiftStdlib 5 . 1 , * )
14
14
struct NS2 { // expected-note{{consider making struct 'NS2' conform to the 'Sendable' protocol}}
@@ -21,34 +21,42 @@ struct NS3 { }
21
21
@available ( SwiftStdlib 5 . 3 , * )
22
22
extension NS3 : Sendable { }
23
23
24
+ @available ( SwiftStdlib 5 . 1 , * )
25
+ class NS4 { } // expected-note{{class 'NS4' does not conform to the 'Sendable' protocol}}
26
+
24
27
@available ( SwiftStdlib 5 . 1 , * )
25
28
func acceptCV< T: Sendable > ( _: T ) { }
26
29
27
30
func acceptSendableFn( _: @Sendable @escaping ( ) -> Void ) { }
28
31
29
32
@available ( SwiftStdlib 5 . 1 , * )
30
33
func testCV(
31
- ns1: NS1 , ns1array: [ NS1 ] , ns2: NS2 , ns3: NS3 , fn: @escaping ( ) -> Void
34
+ ns1: NS1 , ns1array: [ NS1 ] , ns2: NS2 , ns3: NS3 , ns4: NS4 ,
35
+ fn: @escaping ( ) -> Void
32
36
// expected-note@-1{{parameter 'fn' is implicitly non-sendable}}
33
37
) {
34
- acceptCV ( ns1)
35
- acceptCV ( ns1array)
38
+ acceptCV ( ns1) // expected-warning{{conformance of 'NS1' to 'Sendable' is unavailable}}
39
+ acceptCV ( ns1array) // expected-warning{{conformance of 'NS1' to 'Sendable' is unavailable}}
36
40
acceptCV ( ns2)
37
- acceptCV ( ns3)
41
+ acceptCV ( ns3) // expected-warning{{conformance of 'NS3' to 'Sendable' is only available in macOS 11.0 or newer}}
42
+ // expected-note@-1{{add 'if #available' version check}}
43
+ acceptCV ( ns4)
38
44
acceptCV ( fn)
39
45
acceptSendableFn ( fn) // expected-warning{{passing non-sendable parameter 'fn' to function expecting a @Sendable closure}}
40
46
}
41
47
42
48
@available ( SwiftStdlib 5 . 1 , * )
43
49
func testCV(
44
- ns1: NS1 , ns1array: [ NS1 ] , ns2: NS2 , ns3: NS3 , fn: @escaping ( ) -> Void
50
+ ns1: NS1 , ns1array: [ NS1 ] , ns2: NS2 , ns3: NS3 , ns4: NS4 ,
51
+ fn: @escaping ( ) -> Void
45
52
// expected-note@-1{{parameter 'fn' is implicitly non-sendable}}
46
53
) async {
47
54
acceptCV ( ns1) // expected-warning{{conformance of 'NS1' to 'Sendable' is unavailable}}
48
55
acceptCV ( ns1array) // expected-warning{{conformance of 'NS1' to 'Sendable' is unavailable}}
49
56
acceptCV ( ns2) // expected-warning{{type 'NS2' does not conform to the 'Sendable' protocol}}
50
57
acceptCV ( ns3) // expected-warning{{conformance of 'NS3' to 'Sendable' is only available in macOS 11.0 or newer}}
51
58
// expected-note@-1{{add 'if #available' version check}}
59
+ acceptCV ( ns4) // expected-warning{{type 'NS4' does not conform to the 'Sendable' protocol}}
52
60
acceptCV ( fn) // expected-warning{{type '() -> Void' does not conform to the 'Sendable' protocol}}
53
61
// expected-note@-1{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
54
62
acceptSendableFn ( fn) // expected-error{{passing non-sendable parameter 'fn' to function expecting a @Sendable closure}}
0 commit comments