Skip to content

@preconcurrnecy doesn't downgrade SendableMetatype error #81739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
FranzBusch opened this issue May 23, 2025 · 0 comments · May be fixed by #82004
Open

@preconcurrnecy doesn't downgrade SendableMetatype error #81739

FranzBusch opened this issue May 23, 2025 · 0 comments · May be fixed by #82004
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. concurrency Feature: umbrella label for concurrency language features

Comments

@FranzBusch
Copy link
Member

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

@FranzBusch FranzBusch added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels May 23, 2025
@ktoso ktoso added concurrency Feature: umbrella label for concurrency language features and removed triage needed This issue needs more specific labels labels May 23, 2025
xedin added a commit to xedin/swift that referenced this issue Jun 4, 2025
…ike `Sendable` ones

No warnings with minimal checking, warnings with `strict-concurrency=complete` and
if declaration is `@preconcurrency` until next major swift version.

Resolves: rdar://151911135
Resolves: swiftlang#81739
xedin added a commit to xedin/swift that referenced this issue Jun 5, 2025
…ike `Sendable` ones

No warnings with minimal checking, warnings with `strict-concurrency=complete` and
if declaration is `@preconcurrency` until next major swift version.

Resolves: rdar://151911135
Resolves: swiftlang#81739
xedin added a commit to xedin/swift that referenced this issue Jun 5, 2025
…ike `Sendable` ones

No warnings with minimal checking, warnings with `strict-concurrency=complete` and
if declaration is `@preconcurrency` until next major swift version.

Resolves: rdar://151911135
Resolves: swiftlang#81739
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. concurrency Feature: umbrella label for concurrency language features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants