Skip to content
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

Swift 6.1 regression creating AnyHashable from existential with parameter pack #79623

Open
stephencelis opened this issue Feb 25, 2025 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@stephencelis
Copy link
Contributor

Description

Code involving AnyHashable, existentials, and parameter packs that used to compile in Swift 6.0.3 no longer compiles in 6.1.

Reproduction

protocol Bar<T>: Hashable {
  associatedtype T
}
struct Foo<each T> {
  let x: any Bar<(repeat each T)>
  static func == (lhs: Foo, rhs: Foo) -> Bool {
    AnyHashable(lhs.x) == AnyHashable(rhs.x)     // 🛑
    /*
    // Workaround:

    let lhs = lhs.x
    let rhs = rhs.x
    return AnyHashable(lhs) == AnyHashable(rhs)  // ✅
     */
  }
}

Expected behavior

I expect this code to still compile in 6.1.

Environment

swift-driver version: 1.120.2 Apple Swift version 6.1 (swiftlang-6.1.0.106.4 clang-1700.0.9.2)
Target: arm64-apple-macosx15.0

Additional information

No response

@stephencelis stephencelis added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Feb 25, 2025
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. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant