Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Jun 23, 2019

No description provided.

@odersky
Copy link
Contributor Author

odersky commented Jun 23, 2019

There are actually surprisingly few opportunities to use enums. The problem is that most simple enumerations we use in the compiler have bitset structure. So an enum does not work for them, at least
not in a straightforward way.

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Jun 24, 2019

The last one that could be a Scala enum is dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java

@dwijnand
Copy link
Member

Is it not possible to add derives Ordering to those enums, to avoid the .ordinals?

@nicolasstucki
Copy link
Contributor

We also need stable IDs which an ordering would not give.

@dwijnand
Copy link
Member

I was hoping it would use the enum's ordinal?

still doesn't know how derives works or should be used...

@odersky
Copy link
Contributor Author

odersky commented Jun 26, 2019

We could use a derived ordering for these. But for the moment using a couple .ordinals seems OK. It's not so high in priority.

@odersky
Copy link
Contributor Author

odersky commented Jun 26, 2019

The remaining failures have to do with -Ytest-pickler instabilities of positions of Child annotations (fixed in #6752). I'm putting this PR on hold until the next bootstrap compiler is out that fixes the problem.

val methName = normalizeName(meth, tpt).asTermName
val mods = meth.mods
val epbuf = new ListBuffer[ValDef]
val epbuf = ListBuffer[ValDef]()
Copy link
Contributor

Choose a reason for hiding this comment

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

ListBuffer[ValDef] is unambiguous. Meaning there is no question whether it is a reference to an object or a constructor call here because of the type parameters. Can we drop () here in future?

@anatoliykmetyuk anatoliykmetyuk merged commit a76d932 into scala:master Jul 5, 2019
@anatoliykmetyuk anatoliykmetyuk deleted the refactor-use-enums branch July 5, 2019 09:45
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