Say I define some traits with a self-type. Both the traits and the self type have a abstract type member. The abstract type member in the self-type should be overridden by the self-type in the trait.
trait Foo{
type My
def make:Seq[My]
}
trait Component {
type My
}
trait Bar extends Foo { this:Component =>
override type My <: StuffDoer
def len = make.map(_.doStuff)
class StuffDoer(str:String) {
def doStuff = "blah"
}
}
This doesn't work and gives the error:
Error:(20, 24) value doStuff is not a member of Bar.this.My
def len = make.map(_.doStuff)
It seems that My inside of Bar is not necessarily a StuffDoer type but why? What are the exact bounds on My inside of Bar? Does Component override it's type boundaries?
What is even more strange is when I change override type My <: StuffDoer inside of Bar to:
override type My = StuffDoer
then suddenly everything compiles. How come???