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-7331] Diagnose protocol 'where' clause with constraints on 'Self' #49879

Closed
swift-ci opened this issue Apr 2, 2018 · 4 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 2, 2018

Previous ID SR-7331
Radar rdar://problem/38077232
Original Reporter Ringo_D (JIRA User)
Type Bug
Status Closed
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: 13963a8c5ddfef7a7c44dea0566027b3

duplicates:

  • SR-5581 Proper support for protocol 'where' clause with constraints on 'Self'

is duplicated by:

  • SR-8003 Compiler crashed on protocol associatedtype constraint

Issue Description:

protocol P1 {
    func test1() 
}
protocol P2 where Self: P1 {
    func test2()
}
extension P2 {
    func test1() {}
    func test2() {}
}

typealias P = P1 & P2

// test1: Type 'Int' does not conform to protocol P1
extension Int: P {}

// test2: OK
//extension Int: P2, P1 {}
@belkadan
Copy link
Contributor

belkadan commented Apr 3, 2018

Huh. @slavapestov, any ideas?

@swift-ci create

@slavapestov
Copy link
Member

Yeah. The issue, again, is the "where Self : P1". If you write "protocol P2 : P1", then everything works. Incidentally, 'typealias P = P1 & P2' is also redundant in this case, because P2 already implies P1. I'll revisit this as part of the protocol superclass work. We can either make it work, or reliably diagnose constraints on Self.

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

Ringo_D (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@AnthonyLatsis
Copy link
Collaborator

I can verify this works in Xcode 11 beta 2 (11M337n) and a late June master

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

No branches or pull requests

4 participants