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-5341] Protocol with associatedtype constrained to another protocol & inheritance does not compile #47915

Closed
swift-ci opened this issue Jun 30, 2017 · 4 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Jun 30, 2017

Previous ID SR-5341
Radar None
Original Reporter nosyjoe (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42) on macOS Sierra 10.12.5

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

md5: 8c4e951fe2798e81b8c0c71c8419931f

duplicates:

  • SR-55 non-@objc protocol existentials do not conform to their own protocol type

Issue Description:

Given the following three protocol and one class:

protocol View { }

protocol ExtendedView: View {
    func foo()
}

protocol Presenter {
    associatedtype ConcreteView: View
    func attach(view: ConcreteView)
}

class APresenter: Presenter {
    typealias ConcreteView = ExtendedView
    func attach(view: ExtendedView) { }
}

the compiler produces the following error:

{{Error🙁25, 7) type 'APresenter' does not conform to protocol }}'Presenter'

@belkadan
Copy link
Contributor

@belkadan belkadan commented Jul 1, 2017

This is correct-ish behavior, in that a protocol value does not count as a type that conforms to the protocol. @jckarter, is there a particular SR we're tracking this under?

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Jul 4, 2017

Comment by Philipp Engel (JIRA)

Are you considering to change this? To me it makes sense and to have a protocol count as a conforming type.

@jckarter
Copy link
Member

@jckarter jckarter commented Jul 5, 2017

Yeah, it's one facet of "generalized existentials" under Doug's generics manifesto. SR-55 looks like the canonical SR.

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Jul 6, 2017

Comment by Philipp Engel (JIRA)

ok great thx guys! I'm going to check out the Generics Manifesto and follow the process of SR-55 from now on.

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

No branches or pull requests

3 participants