@@ -8,7 +8,7 @@ struct NS1 { }
88@available ( SwiftStdlib 5 . 1 , * )
99@available ( * , unavailable)
1010extension 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}}
1212
1313@available ( SwiftStdlib 5 . 1 , * )
1414struct NS2 { // expected-note{{consider making struct 'NS2' conform to the 'Sendable' protocol}}
@@ -21,34 +21,42 @@ struct NS3 { }
2121@available ( SwiftStdlib 5 . 3 , * )
2222extension NS3 : Sendable { }
2323
24+ @available ( SwiftStdlib 5 . 1 , * )
25+ class NS4 { } // expected-note{{class 'NS4' does not conform to the 'Sendable' protocol}}
26+
2427@available ( SwiftStdlib 5 . 1 , * )
2528func acceptCV< T: Sendable > ( _: T ) { }
2629
2730func acceptSendableFn( _: @Sendable @escaping ( ) -> Void ) { }
2831
2932@available ( SwiftStdlib 5 . 1 , * )
3033func 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
3236 // expected-note@-1{{parameter 'fn' is implicitly non-sendable}}
3337) {
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}}
3640 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)
3844 acceptCV ( fn)
3945 acceptSendableFn ( fn) // expected-warning{{passing non-sendable parameter 'fn' to function expecting a @Sendable closure}}
4046}
4147
4248@available ( SwiftStdlib 5 . 1 , * )
4349func 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
4552 // expected-note@-1{{parameter 'fn' is implicitly non-sendable}}
4653) async {
4754 acceptCV ( ns1) // expected-warning{{conformance of 'NS1' to 'Sendable' is unavailable}}
4855 acceptCV ( ns1array) // expected-warning{{conformance of 'NS1' to 'Sendable' is unavailable}}
4956 acceptCV ( ns2) // expected-warning{{type 'NS2' does not conform to the 'Sendable' protocol}}
5057 acceptCV ( ns3) // expected-warning{{conformance of 'NS3' to 'Sendable' is only available in macOS 11.0 or newer}}
5158 // expected-note@-1{{add 'if #available' version check}}
59+ acceptCV ( ns4) // expected-warning{{type 'NS4' does not conform to the 'Sendable' protocol}}
5260 acceptCV ( fn) // expected-warning{{type '() -> Void' does not conform to the 'Sendable' protocol}}
5361 // expected-note@-1{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
5462 acceptSendableFn ( fn) // expected-error{{passing non-sendable parameter 'fn' to function expecting a @Sendable closure}}
0 commit comments