Skip to content

[SR-5610] Incorrect redundant same-type constraint warning related to recursive constraints #48180

@jepers

Description

@jepers
Previous ID SR-5610
Radar None
Original Reporter @jepers
Type Bug
Status Closed
Resolution Done
Environment

Xcode 9 beta 4, dev snapshot 2017-07-31

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @DougGregor
Priority Medium

md5: f0aea715c2c4dc6b1e1eb164db9de82a

Issue Description:

protocol P1 {
    associatedtype X: P2 where X.Q == Self, X.R == UInt8
}
struct A: P1 {
    typealias X = S<UInt8>
}
protocol P2 {
    associatedtype Q: P1
    associatedtype R
}
struct S<E> : P2 {
    typealias R = E
    typealias Q = A
}
extension P2 {
    func map<T>(transform: (R) -> T.R) -> T
        where T: P2, Q == T.Q // <-- Incorrect warning here:
        //     ^----------------------------------------------------------.
        // Redundant same-type constraint 'Self.Q' == 'T.Q'               |
        // Previous same-type constraint 'T.Q' == 'T.Q.X.Q' implied here -'
    {
        fatalError() // <-- Not important ...
    }
}

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions