You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have a look at pending/pos/S5.scala. Here we have an inner class with the same name "n" as
a val in the same scope. It follows that creating a companion object for the class will create an illegal
double definition. This currently leads to an override error in RefChecks because the newly created
companion object does not have the same type as the val overridden by the same-named value in
the class.
What should we do about this? This looks very messy. I see three alternatives, all not super attractive:
We do not generate companion classes automatically. But then where to put extension methods, tailrec methods, etc?
We disallow classes to have the same name (module type/term) as a value in the same scope. That looks irregular and hacky.
We somehow name companions differently if they conflict. That seems to be the best solution,
but it looks complicated.
Any other ideas?
The text was updated successfully, but these errors were encountered:
Have a look at pending/pos/S5.scala. Here we have an inner class with the same name "n" as
a
val
in the same scope. It follows that creating a companion object for the class will create an illegaldouble definition. This currently leads to an override error in RefChecks because the newly created
companion object does not have the same type as the
val
overridden by the same-named value inthe class.
What should we do about this? This looks very messy. I see three alternatives, all not super attractive:
but it looks complicated.
Any other ideas?
The text was updated successfully, but these errors were encountered: