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

Exposing a distinct "value" parameter for enumeration members, to avoid relying on default toString() #936

Merged

Conversation

blast-hardcheese
Copy link
Contributor

  • def value: String on containing enumeration could be a val value: String if you prefer. I think having a weak reference there is better for some reason, but I can't remember why or if this is true.
  • This is motivated by having been bit by refactors that change a member from a discrete type to an Option[A] or List[A] or otherwise, but relying on the default .toString() doesn't flag this as an error. This also provides an alternative for those using wartremover's ToString wart, which prevents relying on the default toString as well.

This was able to be merged without conflict after applying #934, another reason for not changing too much about emitted classes

@blast-hardcheese blast-hardcheese force-pushed the expose-enum-value-accessor branch from 1f9c946 to 8b13fb8 Compare June 23, 2021 23:31
Copy link
Owner

@ghostdogpr ghostdogpr left a comment

Choose a reason for hiding this comment

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

LGTM!

@ghostdogpr ghostdogpr merged commit 29a8d0d into ghostdogpr:master Jun 24, 2021
@blast-hardcheese blast-hardcheese deleted the expose-enum-value-accessor branch June 24, 2021 00:50
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.

2 participants