-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SE-0036 (3/3): Provide errors when referencing enum elements on instances #2843
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
Conversation
@@ -139,6 +139,8 @@ Swift 3.0 | |||
`NS[Mutable]Dictionary` are still imported as nongeneric classes for | |||
the time being. | |||
|
|||
* [SE-0036](https://github.com/apple/swift-evolution/blob/master/proposals/0036-enum-dot.md): | |||
Enum elements can no longer be accessed like instance members in instance methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a newline after for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@DougGregor or @lattner can you take a look at this patch? |
I guess this will still need to be merged for Swift 3 |
@swift-ci please smoke test and merge |
…members This removes the logic which issued warnings when accessing enum elements as instance members (SE-0036), making room for a new implementation that will issue errors instead. This reverts commit ae1058a.
This implements SE-0036.
The LLDB failures are real... it looks like there are a few test cases that need to be updated there. @ahoppen, can you create a PR against LLDB to fix up those errors? We'll merge that one first. |
LLDB pull request is created apple/swift-lldb#35 |
@swift-ci please smoke test and merge |
LLDB PR merged, so I kicked off another round of smoke-test-and-merge |
What's in this pull request?
This is part 3/3 implementing SE-0036.
It undos the changes done in #2842 that provided warnings when an enum element was referenced on an enum and implements a different logic that throws errors instead.
It has slightly better fix-its than the warning-based approach because it can also detect if a single dot suffices as a fix-it in expressions where the type can be inferred on the context, e.g. in
self = .A
. However, it looses the ability to infer a single-dot fix-it incase
statements for generic enums.The resulting code is basically the same as in #2634.
Dependencies
Same text as in #2842:
I wasn’t sure how I should handle the multi-staged rollout of SE-0036 as described here. So this PR includes the changes to the test cases that shall be merged in #2841 and #2842 and builds on top of them, i.e. the branch for this PR is two commits ahead of the one for #2842. I hope that’s the right way to go, otherwise let me know.
Resolved bug number: (SR-1236)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.