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-11007] Protocol Extension with RawValue not working #53397

Closed
swift-ci opened this issue Jun 24, 2019 · 3 comments
Closed

[SR-11007] Protocol Extension with RawValue not working #53397

swift-ci opened this issue Jun 24, 2019 · 3 comments
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

Previous ID SR-11007
Radar None
Original Reporter rexmas (JIRA User)
Type Bug
Status Closed
Resolution Invalid
Environment

Swift 5, Xcode 10.2

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

md5: f394c00ca6e6f7b32e009f6867b4e1a2

Issue Description:

public protocol EventTrackable {
    var eventName: String { get }
}

public protocol KeyedEventTrackable: EventTrackable {
    var eventKey: String { get }
}

public extension KeyedEventTrackable where Self: RawRepresentable, Self.RawValue == String {
    var eventName: String {
        return self.rawValue
    }
}

enum MyEvent: String, KeyedEventTrackable {
    case event = "cool.event"
} 

Receive: "Type 'MyEvent' does not conform to protocol 'KeyedEventTrackable'".
Expect: It compiles.

@Agarunov
Copy link

You forgot to implement eventKey property in MyEvent enum or in KeyedEventTrackable extension

@belkadan
Copy link
Contributor

Anton is correct; if I remove that requirement it works as expected.

@swift-ci
Copy link
Collaborator Author

Comment by Rex Fenley (JIRA)

Oh wow... talk about user error... embarrassing :|

@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

3 participants