Skip to content

Change "enum element" to "enum case" in diagnostics #17964

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

Merged
merged 1 commit into from
Jul 15, 2018

Conversation

mdiep
Copy link
Contributor

@mdiep mdiep commented Jul 15, 2018

From the perspective of the compiler implementation, they're elements. But users will think of these as cases—and many diagnostics already refer to these as enum cases.

@@ -117,7 +117,7 @@ ERROR(could_not_use_type_member_on_instance,none,
"static member %1 cannot be used on instance of type %0",
(Type, DeclName))
ERROR(could_not_use_enum_element_on_instance,none,
"enum element %0 cannot be referenced as an instance member",
"enum case %0 cannot be used as an instance member",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also changed referenced to used here. That seems both clearer and more consistent with other diagnostics.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This disgnostic should be specialized for implicit self so we can offer something more specific than this. Especially in the common “switch-case is missing a leading dot” examples.

Not something to worry about here, but definitely nice to have in a follow-up.

@mdiep
Copy link
Contributor Author

mdiep commented Jul 15, 2018

Also, the documentation clearly refers to these as cases and never uses the term elements:

Multiple cases can appear on a single line, separated by commas:

enum Planet {
    case mercury, venus, earth, mars, jupiter, saturn, uranus, neptune
}

@CodaFi
Copy link
Contributor

CodaFi commented Jul 15, 2018

Goodbye C++isms, hello Swift

⛵️

@swift-ci please smoke test and merge

From the perspective of the compiler implementation, they're elements. But users will think of these as cases—and many diagnostics already refer to these as enum cases.
@mdiep mdiep force-pushed the enum-case-not-enum-element branch from 5d9bd74 to 3559274 Compare July 15, 2018 20:01
@mdiep
Copy link
Contributor Author

mdiep commented Jul 15, 2018

Somehow I missed a test the first time around. 🙈 Updated.

@xedin
Copy link
Contributor

xedin commented Jul 15, 2018

@swift-ci please smoke test and merge

@CodaFi
Copy link
Contributor

CodaFi commented Jul 15, 2018

@swift-ci please smoke test

@CodaFi CodaFi merged commit c3867c8 into swiftlang:master Jul 15, 2018
@mdiep mdiep deleted the enum-case-not-enum-element branch July 15, 2018 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants