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( ) { }
@@ -314,6 +315,7 @@ func check() async {
314
315
_ = await BazFrame ( size: 0 )
315
316
}
316
317
318
+ @available ( SwiftStdlib 5 . 5 , * )
317
319
func testSender(
318
320
sender: NXSender ,
319
321
sendableObject: SendableClass ,
@@ -325,7 +327,7 @@ func testSender(
325
327
nonSendableGeneric: GenericObject < SendableClass > ,
326
328
ptr: UnsafeMutableRawPointer ,
327
329
stringArray: [ String ]
328
- ) {
330
+ ) async {
329
331
sender. sendAny ( sendableObject)
330
332
sender. sendAny ( nonSendableObject)
331
333
// expected-warning@-1 {{conformance of 'NonSendableClass' to 'Sendable' is unavailable}}
@@ -344,22 +346,22 @@ func testSender(
344
346
345
347
sender. sendProto ( sendableProtos)
346
348
sender. sendProto ( nonSendableProtos)
347
- // expected-error@-1 {{argument type 'any LabellyProtocol & ObjCClub' does not conform to expected type 'Sendable'}}
348
- // FIXME(rdar://89992095): Should be a warning because we're in -warn-concurrency
349
+ // expected-warning@-1 {{type 'any LabellyProtocol & ObjCClub' does not conform to the 'Sendable' protocol}}
349
350
350
351
sender. sendProtos ( sendableProtos)
351
352
sender. sendProtos ( nonSendableProtos)
352
- // expected-error@-1 {{argument type 'any LabellyProtocol & ObjCClub' does not conform to expected type 'Sendable'}}
353
- // FIXME(rdar://89992095): Should be a warning because we're in -warn-concurrency
353
+ // expected-warning@-1 {{type 'any LabellyProtocol & ObjCClub' does not conform to the 'Sendable' protocol}}
354
354
355
355
sender. sendAnyArray ( [ sendableObject] )
356
356
sender. sendAnyArray ( [ nonSendableObject] )
357
- // expected-warning@-1 {{conformance of 'NonSendableClass' to 'Sendable' is unavailable}}
357
+ // expected-warning@-1 {{conformance of 'NonSendableClass' to 'Sendable' is unavailable; this is an error in Swift 6 }}
358
358
359
359
sender. sendGeneric ( sendableGeneric)
360
+ // expected-warning@-1{{type 'GenericObject<SendableClass>' does not conform to the 'Sendable' protocol}}
361
+ // FIXME: Shouldn't warn
362
+
360
363
sender. sendGeneric ( nonSendableGeneric)
361
- // expected-error@-1 {{argument type 'GenericObject<SendableClass>' does not conform to expected type 'Sendable'}}
362
- // FIXME(rdar://89992095): Should be a warning because we're in -warn-concurrency
364
+ // expected-warning@-1 {{type 'GenericObject<SendableClass>' does not conform to the 'Sendable' protocol}}
363
365
364
366
sender. sendPtr ( ptr)
365
367
sender. sendStringArray ( stringArray)
0 commit comments