Skip to content

@preconcurrnecy doesn't downgrade SendableMetatype error #81739

Open
@FranzBusch

Description

@FranzBusch

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions