Avatar
Avatar
omochimetaru
@swift-6.0.3 -swift-version 6 -enable-upcoming-feature InferSendableFromCaptures protocol ServiceTransport<Service> { associatedtype Service func register( methodSelector: @escaping @Sendable (Service.Type) -> (Service) -> () async throws -> Void ) } protocol P { func foo() } func f(transport: some ServiceTransport<some P & SendableMetatype>) { transport.register { $0.foo } } #if swift(>=6.2) typealias SendableMetatype = Swift.SendableMetatype #else typealias SendableMetatype = Any #endif
exit status 1 with stderr:<unknown>:0: error: upcoming feature 'InferSendableFromCaptures' is already enabled as of Swift version 6 <unknown>:0: error: implicit capture of 'self' requires that 'some P & SendableMetatype' conforms to `Sendable` <stdin>:12:41: note: consider making generic parameter 'some P & SendableMetatype' conform to the 'Sendable' protocol 10 | } 11 | 12 | func f(transport: some ServiceTransport<some P & SendableMetatype>) { | `- note: consider making generic parameter 'some P & SendableMetatype' conform to the 'Sendable' protocol 13 | transport.register { 14 | $0.foo