@@ -198,26 +198,46 @@ func requireSendable<T: Sendable>(_: T) {}
198198@preconcurrency
199199struct RequireSendable < T: Sendable > { }
200200
201- class NotSendable { } // expected-note 4 {{class 'NotSendable' does not conform to the 'Sendable' protocol}}
201+ class NotSendable { } // expected-note 8 {{class 'NotSendable' does not conform to the 'Sendable' protocol}}
202202
203203class UnavailableSendable { }
204204
205205@available ( * , unavailable)
206206extension UnavailableSendable : @unchecked Sendable { }
207- // expected-note@-1 4 {{conformance of 'UnavailableSendable' to 'Sendable' has been explicitly marked unavailable here}}
207+ // expected-note@-1 8 {{conformance of 'UnavailableSendable' to 'Sendable' has been explicitly marked unavailable here}}
208208
209209typealias T = RequireSendable < NotSendable >
210210// expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
211211
212212typealias T2 = RequireSendable < UnavailableSendable >
213213// expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
214214
215- func testRequirementDowngrade( ns: NotSendable , us: UnavailableSendable ) {
215+ class C {
216+ @preconcurrency
217+ func requireSendable< T: Sendable > ( _: T ) { }
218+
219+ @preconcurrency
220+ static func requireSendableStatic< T: Sendable > ( _: T ) { }
221+ }
222+
223+ func testRequirementDowngrade( ns: NotSendable , us: UnavailableSendable , c: C ) {
216224 requireSendable ( ns)
217225 // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
218226
227+ c. requireSendable ( ns)
228+ // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
229+
230+ C . requireSendableStatic ( ns)
231+ // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
232+
219233 requireSendable ( us)
220234 // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
235+
236+ c. requireSendable ( us)
237+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
238+
239+ C . requireSendableStatic ( us)
240+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
221241}
222242
223243
@@ -232,13 +252,33 @@ func requireSendableExistential(_: any P2 & Sendable) {}
232252
233253func requireSendableExistentialAlways( _: any P2 & Sendable ) { }
234254
235- func testErasureDowngrade( ns: NotSendable , us: UnavailableSendable ) {
255+ extension C {
256+ @preconcurrency
257+ func requireSendableExistential( _: any P2 & Sendable ) { }
258+
259+ @preconcurrency
260+ static func requireSendableExistentialStatic( _: any P2 & Sendable ) { }
261+ }
262+
263+ func testErasureDowngrade( ns: NotSendable , us: UnavailableSendable , c: C ) {
236264 requireSendableExistential ( ns)
237265 // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
238266
267+ c. requireSendableExistential ( ns)
268+ // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
269+
270+ C . requireSendableExistentialStatic ( ns)
271+ // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
272+
239273 requireSendableExistential ( us)
240274 // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
241275
276+ c. requireSendableExistential ( us)
277+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
278+
279+ C . requireSendableExistentialStatic ( us)
280+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
281+
242282 withSendableClosure {
243283 let ns = NotSendable ( )
244284 requireSendableExistentialAlways ( ns)
0 commit comments