Skip to content

make fromOrdinal public and always available #9987

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 4 commits into from
Oct 15, 2020

Conversation

bishabosha
Copy link
Member

fromOrdinal exists on the companion object of an enum and is always defined, even if there are no value cases

@bishabosha bishabosha requested a review from sjrd October 12, 2020 14:21
@bishabosha
Copy link
Member Author

tests are passing @sjrd is it correct that the fromOrdinal method should always be generated

@sjrd
Copy link
Member

sjrd commented Oct 14, 2020

TBH I don't know. I have no recollection of what we discussed about fromOrdinal, and I haven't written down anything about that in my notes :(

@bishabosha
Copy link
Member Author

bishabosha commented Oct 14, 2020

Perhaps it was only if there there is at least one value :/ but I suppose this is meant to be low level for serialisation so it may be simpler to say its always there, as dual to def ordinal, which is always there for the same reason (as long as Mirror can be generated)

@sjrd
Copy link
Member

sjrd commented Oct 14, 2020

Perhaps it was only if there there is at least one value :/

No, it's probably always. The other possibilities do not make sense.

What I'm not sure is whether we actually decided to make this public. But if we did, then it should definitely be always.

@bishabosha
Copy link
Member Author

What I'm not sure is whether we actually decided to make this public.

its supposed to be the method thats available for an arbitrary serialisation framework so I would assume external access is required

@bishabosha
Copy link
Member Author

what should happen with this?

Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

I guess it should be merged.

@bishabosha bishabosha merged commit 0525ba0 into scala:master Oct 15, 2020
@bishabosha bishabosha deleted the topic/enum-fromOrdinal branch October 15, 2020 09:57
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

4 participants