Given the abstract definitions of the Outer
class and its Inner
class I would like to instantiate the concrete Inner1
class defined within Outer1
trait.
abstract class Outer {
type Inner_Tp <: Inner;
abstract class Inner {
self: Inner_Tp =>
}
}
trait Outer1 {
self: Outer =>
protected class Inner1 extends Inner {
self: Inner_Tp =>
}
def Inner1() = new Inner1()
}
The Scala compiler prematurely terminates the compilation giving me the following error message: "error: class Inner1 cannot be instantiated because it does not conform to its self-type Outer1.this.Inner1 with Outer1.this.Inner_Tp". Why?
After all the Inner1
class is defined within an abstract context being its Outer1
trait. I would like to postpone the definition of type Inner_Tp
until the trait gets mixed into some concrete class.