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-14917] Inconsistent/missing warning about redundant same-type constraint #57264

Closed
jepers opened this issue Jul 13, 2021 · 4 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@jepers
Copy link

jepers commented Jul 13, 2021

Previous ID SR-14917
Radar rdar://problem/80820294
Original Reporter @jepers
Type Bug
Status Resolved
Resolution Done
Environment

macOS 11.3, Xcode 12.5 and 12.5.1

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

md5: 5107e4b57e6a7f5c8dd5e4d6703b74f3

Issue Description:

This compiles with the expected warning:

struct S<T: Collection> where T.Index == T.Indices.Index {} // Warning: Redundant same-type constraint `T.Index` == `T.Indices.Index`

But this compiles without any warning:

extension Collection where Self.Index == Self.Indices.Index {} // No warning

I would have expected the same warning here.

This inconsistent behaviour is reproduced by eg:

protocol P {
  associatedtype A
  associatedtype AS: Q where AS.B == A
}

protocol Q {
  associatedtype B
}

struct S<T: P> where T.AS.B == T.A {} // Warning as expected

extension P where AS.B == A {} // No warning
@typesanitizer
Copy link

cc @slavapestov

@slavapestov
Copy link
Member

@swift-ci create

@slavapestov
Copy link
Member

We're probably losing track of a source location somewhere.

@slavapestov
Copy link
Member

#42113

@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.
Projects
None yet
Development

No branches or pull requests

3 participants