I have two traits, one extending the other, each with an inner class, one extending the other, with the same names:
trait A {
class X {
def x() = doSomething()
}
}
trait B extends A {
class X extends super.X {
override def x() = doSomethingElse()
}
}
class C extends B {
val x = new X() // here B.X is instantiated
val y = new A.X() // does not compile
val z = new A.this.X() // does not compile
}
How do I access A.X
class in the C
class's body? Renaming B.X
not to hide A.X
is not a preferred way.
To make things a bit complicated, in the situation I have encountered this problem the traits have type parameters (not shown in this example).