-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
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?
Metadata
Metadata
Assignees
Labels
No labels