@@ -182,31 +182,52 @@ struct RequireSendable<T: Sendable> {}
182182
183183class NotSendable { } // expected-note 4 {{class 'NotSendable' does not conform to the 'Sendable' protocol}}
184184
185+ class UnavailableSendable { }
186+
187+ @available ( * , unavailable)
188+ extension UnavailableSendable : @unchecked Sendable { }
189+ // expected-note@-1 4 {{conformance of 'UnavailableSendable' to 'Sendable' has been explicitly marked unavailable here}}
190+
185191typealias T = RequireSendable < NotSendable >
186192// expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
187193
188- func testRequirementDowngrade( ns: NotSendable ) {
194+ typealias T2 = RequireSendable < UnavailableSendable >
195+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
196+
197+ func testRequirementDowngrade( ns: NotSendable , us: UnavailableSendable ) {
189198 requireSendable ( ns)
190199 // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
200+
201+ requireSendable ( us)
202+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
191203}
192204
193205
194206protocol P2 { }
195207
196208extension NotSendable : P2 { }
197209
210+ extension UnavailableSendable : P2 { }
211+
198212@preconcurrency
199213func requireSendableExistential( _: any P2 & Sendable ) { }
200214
201215func requireSendableExistentialAlways( _: any P2 & Sendable ) { }
202216
203- func testErasureDowngrade( ns: NotSendable ) {
217+ func testErasureDowngrade( ns: NotSendable , us : UnavailableSendable ) {
204218 requireSendableExistential ( ns)
205219 // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
206220
221+ requireSendableExistential ( us)
222+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
223+
207224 withSendableClosure {
208225 let ns = NotSendable ( )
209226 requireSendableExistentialAlways ( ns)
210227 // expected-error@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
228+
229+ let us = UnavailableSendable ( )
230+ requireSendableExistentialAlways ( us)
231+ // expected-error@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
211232 }
212233}
0 commit comments