4
4
// REQUIRES: concurrency
5
5
import Foundation
6
6
import ObjCConcurrency
7
+ // expected-remark@-1{{add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'ObjCConcurrency'}}
7
8
8
9
@available ( SwiftStdlib 5 . 5 , * )
9
10
@MainActor func onlyOnMainActor( ) { }
@@ -322,6 +323,7 @@ func check() async {
322
323
_ = await BazFrame ( size: 0 )
323
324
}
324
325
326
+ @available ( SwiftStdlib 5 . 5 , * )
325
327
func testSender(
326
328
sender: NXSender ,
327
329
sendableObject: SendableClass ,
@@ -333,7 +335,7 @@ func testSender(
333
335
nonSendableGeneric: GenericObject < SendableClass > ,
334
336
ptr: UnsafeMutableRawPointer ,
335
337
stringArray: [ String ]
336
- ) {
338
+ ) async {
337
339
sender. sendAny ( sendableObject)
338
340
sender. sendAny ( nonSendableObject)
339
341
// expected-warning@-1 {{conformance of 'NonSendableClass' to 'Sendable' is unavailable}}
@@ -352,22 +354,22 @@ func testSender(
352
354
353
355
sender. sendProto ( sendableProtos)
354
356
sender. sendProto ( nonSendableProtos)
355
- // expected-error@-1 {{argument type 'any LabellyProtocol & ObjCClub' does not conform to expected type 'Sendable'}}
356
- // FIXME(rdar://89992095): Should be a warning because we're in -warn-concurrency
357
+ // expected-warning@-1 {{type 'any LabellyProtocol & ObjCClub' does not conform to the 'Sendable' protocol}}
357
358
358
359
sender. sendProtos ( sendableProtos)
359
360
sender. sendProtos ( nonSendableProtos)
360
- // expected-error@-1 {{argument type 'any LabellyProtocol & ObjCClub' does not conform to expected type 'Sendable'}}
361
- // FIXME(rdar://89992095): Should be a warning because we're in -warn-concurrency
361
+ // expected-warning@-1 {{type 'any LabellyProtocol & ObjCClub' does not conform to the 'Sendable' protocol}}
362
362
363
363
sender. sendAnyArray ( [ sendableObject] )
364
364
sender. sendAnyArray ( [ nonSendableObject] )
365
- // expected-warning@-1 {{conformance of 'NonSendableClass' to 'Sendable' is unavailable}}
365
+ // expected-warning@-1 {{conformance of 'NonSendableClass' to 'Sendable' is unavailable; this is an error in Swift 6 }}
366
366
367
367
sender. sendGeneric ( sendableGeneric)
368
+ // expected-warning@-1{{type 'GenericObject<SendableClass>' does not conform to the 'Sendable' protocol}}
369
+ // FIXME: Shouldn't warn
370
+
368
371
sender. sendGeneric ( nonSendableGeneric)
369
- // expected-error@-1 {{argument type 'GenericObject<SendableClass>' does not conform to expected type 'Sendable'}}
370
- // FIXME(rdar://89992095): Should be a warning because we're in -warn-concurrency
372
+ // expected-warning@-1 {{type 'GenericObject<SendableClass>' does not conform to the 'Sendable' protocol}}
371
373
372
374
sender. sendPtr ( ptr)
373
375
sender. sendStringArray ( stringArray)
0 commit comments