Avatar
Avatar
Iceman
@swift-5.6.3 -warn-concurrencyimport Foundation @preconcurrency import struct Foundation.NSRange func f() { let range = NSRange.init() let string = NSString.init() Task { print(range, string) } }
stderr:<stdin>:8:15: warning: capture of 'range' with non-sendable type 'NSRange' (aka '_NSRange') in a `@Sendable` closure print(range, string) ^ Foundation._NSRange:1:15: note: struct '_NSRange' does not conform to the 'Sendable' protocol public struct _NSRange { ^ <stdin>:1:1: remark: add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'Foundation' import Foundation ^ @preconcurrency <stdin>:8:22: warning: capture of 'string' with non-sendable type 'NSString' in a `@Sendable` closure print(range, string) ^ Foundation.NSString:1:12: note: class 'NSString' does not conform to the 'Sendable' protocol open class NSString : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCoding { ^ <stdin>:2:17: remark: '@preconcurrency' attribute on module 'Foundation' is unused @preconcurrency import struct Foundation.NSRange ~~~~~~~~~~~~~~~~^