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

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

Merged
merged 1 commit into from Jul 15, 2018

Conversation

Projects
None yet
3 participants
@mdiep
Copy link
Contributor

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",

This comment has been minimized.

@mdiep

mdiep Jul 15, 2018

Contributor

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

This comment has been minimized.

@CodaFi

CodaFi Jul 15, 2018

Collaborator

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Collaborator

CodaFi commented Jul 15, 2018

Goodbye C++isms, hello Swift

⛵️

@swift-ci please smoke test and merge

Change "enum element" to "enum case" in diagnostics
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 mdiep:enum-case-not-enum-element branch to 3559274 Jul 15, 2018

@mdiep

This comment has been minimized.

Copy link
Contributor

mdiep commented Jul 15, 2018

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

@xedin

This comment has been minimized.

Copy link
Member

xedin commented Jul 15, 2018

@swift-ci please smoke test and merge

@CodaFi

This comment has been minimized.

Copy link
Collaborator

CodaFi commented Jul 15, 2018

@swift-ci please smoke test

@CodaFi CodaFi merged commit c3867c8 into apple:master Jul 15, 2018

2 checks passed

Swift Test Linux Platform (smoke test)
Details
Swift Test OS X Platform (smoke test)
Details

@mdiep mdiep deleted the mdiep:enum-case-not-enum-element branch Jul 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment