@@ -180,26 +180,46 @@ func requireSendable<T: Sendable>(_: T) {}
180180@preconcurrency
181181struct RequireSendable < T: Sendable > { }
182182
183- class NotSendable { } // expected-note 4 {{class 'NotSendable' does not conform to the 'Sendable' protocol}}
183+ class NotSendable { } // expected-note 8 {{class 'NotSendable' does not conform to the 'Sendable' protocol}}
184184
185185class UnavailableSendable { }
186186
187187@available ( * , unavailable)
188188extension UnavailableSendable : @unchecked Sendable { }
189- // expected-note@-1 4 {{conformance of 'UnavailableSendable' to 'Sendable' has been explicitly marked unavailable here}}
189+ // expected-note@-1 8 {{conformance of 'UnavailableSendable' to 'Sendable' has been explicitly marked unavailable here}}
190190
191191typealias T = RequireSendable < NotSendable >
192192// expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
193193
194194typealias T2 = RequireSendable < UnavailableSendable >
195195// expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
196196
197- func testRequirementDowngrade( ns: NotSendable , us: UnavailableSendable ) {
197+ class C {
198+ @preconcurrency
199+ func requireSendable< T: Sendable > ( _: T ) { }
200+
201+ @preconcurrency
202+ static func requireSendableStatic< T: Sendable > ( _: T ) { }
203+ }
204+
205+ func testRequirementDowngrade( ns: NotSendable , us: UnavailableSendable , c: C ) {
198206 requireSendable ( ns)
199207 // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
200208
209+ c. requireSendable ( ns)
210+ // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
211+
212+ C . requireSendableStatic ( ns)
213+ // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
214+
201215 requireSendable ( us)
202216 // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
217+
218+ c. requireSendable ( us)
219+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
220+
221+ C . requireSendableStatic ( us)
222+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
203223}
204224
205225
@@ -214,13 +234,33 @@ func requireSendableExistential(_: any P2 & Sendable) {}
214234
215235func requireSendableExistentialAlways( _: any P2 & Sendable ) { }
216236
217- func testErasureDowngrade( ns: NotSendable , us: UnavailableSendable ) {
237+ extension C {
238+ @preconcurrency
239+ func requireSendableExistential( _: any P2 & Sendable ) { }
240+
241+ @preconcurrency
242+ static func requireSendableExistentialStatic( _: any P2 & Sendable ) { }
243+ }
244+
245+ func testErasureDowngrade( ns: NotSendable , us: UnavailableSendable , c: C ) {
218246 requireSendableExistential ( ns)
219247 // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
220248
249+ c. requireSendableExistential ( ns)
250+ // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
251+
252+ C . requireSendableExistentialStatic ( ns)
253+ // expected-warning@-1 {{type 'NotSendable' does not conform to the 'Sendable' protocol}}
254+
221255 requireSendableExistential ( us)
222256 // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
223257
258+ c. requireSendableExistential ( us)
259+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
260+
261+ C . requireSendableExistentialStatic ( us)
262+ // expected-warning@-1 {{conformance of 'UnavailableSendable' to 'Sendable' is unavailable}}
263+
224264 withSendableClosure {
225265 let ns = NotSendable ( )
226266 requireSendableExistentialAlways ( ns)
0 commit comments