My question is simple.
Why does this code make an error,
abstract class A {
type T <: A.Inner
def toT: T = new A.Inner(this)
}
object A {
class Inner(a: A)
}
// Exiting paste mode, now interpreting.
<console>:16: error: type mismatch;
found : A.Inner
required: A.this.T
def toT: T = new A.Inner(this)
^
whereas this code does not?
abstract class A {
type T = A.Inner
def toT: T = new A.Inner(this)
}
object A {
class Inner(a: A)
}
// Exiting paste mode, now interpreting.
defined class A
defined object A
A.Inner <: A.Inner
. Isn't it?