Given the following definitions of Scala
abstract class C { type T1 <: { def m() : Int } type T2 <: { def n() : Int } }
Is there a way to define a third type inside C that is limited to the subtype T1 and T2? For instance.
type T3 <: T1 & T2 // does not compile
It seems to me that (part) the reason why this will not work as it is written is because I cannot be sure that this will not lead to an illegal restriction (for example, it inherits from two classes). So the related question would be if I could limit T1 and T2 to be legal, for example. demanding that they both be traits.
source share