Well, I have something like this:
trait A
class Serving(a: => A)
object App extends Serving(App.Main) {
object Main extends A
}
And I get the error super constructor cannot be passed a self reference unless parameter is declared by-name
. I can work around by doing
object App extends Serving(Serv.Main)
object Serv {
object Main extends A
}
but I don't want to. It adds 2 extra .class
es and it strikes me as unelegant.
And using object App extends Serving(this.Main)
also creates an error. The structure of A
and Serving
cannot really be changed, but is there any way to work around this error?