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-13963] Unhelpful diagnostic when trying to specify a default getter for computed property in protocol #56360

Closed
typesanitizer opened this issue Dec 12, 2020 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser

Comments

@typesanitizer
Copy link

Previous ID SR-13963
Radar rdar://problem/72268834
Original Reporter @typesanitizer
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Parser
Assignee mininny (JIRA)
Priority Medium

md5: bb0423b199cd83b20b20657513db7389

Issue Description:

Code example:

protocol P {
    var x : Int {
        get { 0 }
        //  ^ error: expected get or set in a protocol property
    }
}

One might look at the diagnostic and think "well, I just wrote a getter, so duh!".

I think we should provide a clearer diagnostic saying that you cannot provide a default implementation for a getter in a protocol, or something along those lines.

@typesanitizer
Copy link
Author

@swift-ci create

@swift-ci
Copy link
Collaborator

Comment by Minhyuk Kim (JIRA)

This looks rather simple, I'll try to fix this

@typesanitizer
Copy link
Author

Fixed in #35230

@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 parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

2 participants