Open
Description
Description
We need a way to stage in the required change of SendableMetatype
without breaking existing clients similar to how we were able to do this with Sendable
.
Reproduction
The following code produces an error even though @preconcurrency
is added to the method in an attempt to downgrade the error:
// Module A
public protocol GlobalLookup {
static func lookupByName(_ name: String) -> Self?
}
public func hasNamed<T: GlobalLookup & SendableMetatype>(_: T.Type, name: String) async -> Bool {
return await Task.detached {
return T.lookupByName(name) != nil
}.value
}
// Module B
func bar<T: GlobalLookup>(t: T.Type) async {
_ = await hasNamed(t.self, name: "p") // error: Global function 'hasNamed(_:name:)' requires that 'T' conform to 'SendableMetatype'
}
Expected behavior
I expect that @preconcurrency
downgrades this to an error
Environment
Latest swift nightly and 6.2 snapshot
Additional information
No response