« Return to Thread: self type is not inherited

self type is not inherited

by Mushtaq Ahmed :: Rate this Message:

Reply to Author | View in Thread

Given that,

trait A
trait B {this: A =>}

Each time we extend B, we need to explicitly specify the self type as A:

trait C extends B {this: A =>}
trait D extends B {this: A =>}
trait E extends B {this: A =>}

Can't this repetition be avoided? Shouldn't self type of C, D and E default to A unless explicitly specified otherwise? Currently, this gives the following error:

trait F extends B
error: illegal inheritance; self-type F does not conform to B's selftype B with A

Regards,
Mushtaq

 « Return to Thread: self type is not inherited