-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Move State companion to the package object #322
Conversation
So just to be clear, people can still reference it as |
Yes and yes. The value alias in the package object allows us to use the name |
👍 thanks! |
An alternative would be: package object state {
type State = ...
object State extends StateCompanion
}
// State.scala
class StateCompanion { ... } That way, the ugly name |
As it stands, `State` causes strange behaviors like State.apply working the first time, but failing the second time to find apply. @retronym pointed to me to SI-7139, which says that the REPL gets confused about the type when there's a type alias and an object named the same. This adds the workaround to SI-7139 by moving State companion into the package object.
37bf89a
to
091f1ba
Compare
Pushed in a new commit with the |
I just ran into the same issue with |
👍 I had done something very similar in a follow-up State branch that it looks like I never turned into a PR. I'll try to come back to that soon. |
Move State companion to the package object
As it stands,
State
causes strange behaviors like State.apply workingthe first time, but failing the second time to find apply. See https://gist.github.com/eed3si9n/9804d496bfeb457282c2
@retronym pointed me to SI-7139, which says that the REPL gets
confused about the type when there's a type alias and an object named
the same.
This adds the workaround posted on SI-7139, which is to move the name
State
into package object.