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

[SR-12478] cannot avoid @_specialize redundant constraint warning #54918

Closed
tayloraswift opened this issue Mar 31, 2020 · 2 comments
Closed

[SR-12478] cannot avoid @_specialize redundant constraint warning #54918

tayloraswift opened this issue Mar 31, 2020 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@tayloraswift
Copy link
Contributor

Previous ID SR-12478
Radar rdar://problem/62201583
Original Reporter @Kelvin13
Type Bug
Status Resolved
Resolution Done
Environment

$ swiftenv version
DEVELOPMENT-SNAPSHOT-2020-02-21-a
$ swift --version
Swift version 5.2-dev (LLVM 4cd92ac, Swift 79716ef)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, TypeChecker
Assignee None
Priority Medium

md5: f0848b048e3b19807c18ed9469c6132b

Issue Description:

Compiling the following code produces a warning

protocol P {}

protocol Q {
  associatedtype T: P
  func foo(_: T)
}

enum A: P {}

enum B: Q {
  func foo(_: A) {}
}

enum E<T> where T: P {}

extension E {
  @_specialize(exported: true, where U == B, T == A)
  func bar<U>(as: U.Type) where U: Q, U.T == T {}
}
redundant-constraint.swift:25:50: warning: redundant same-type constraint 'T' == 'A' @_specialize(exported: true, where U == B, T == A) ^ redundant-constraint.swift:25:42: note: same-type constraint 'U.T' == 'A' implied here @_specialize(exported: true, where U == B, T == A)

but removing it leads to an error

redundant-constraint.swift:25:6: error: too few type parameters are specified in '_specialize' attribute (got 1, but expected 2)
    @_specialize(exported: true, where U == B)
     ^
redundant-constraint.swift:25:6: error: Missing constraint for 'T' in '_specialize' attribute
    @_specialize(exported: true, where U == B)

🙁

@beccadax
Copy link
Contributor

@swift-ci create

@slavapestov
Copy link
Member

This was fixed at some point.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants