[scala] Bounds on abstract types
Hi,
Consider this code:
////////////////////////////////////////
trait A {
type T <: this.type with C
}
trait B extends A {
type T <: this.type with C
}
trait C extends B {
type T <: this.type with C
}
////////////////////////////////////////
Scala compiler rejects it:
<console>:11: error: overriding type T in trait B with bounds >:
Nothing <: C.this.type with C;
type T has incompatible type
type T <: this.type with C
^
But the following is accepted:
////////////////////////////////////////
trait A {
type T <: this.type with C
}
trait B extends A {
type T <: this.type with C
}
trait C extends B {
}
////////////////////////////////////////
Can anybody explain, why?
Thanks,
Vladimir