我上课了几个mixin TraitA和TraitB。
class ClassA
trait TraitA[L]
trait TraitB[L]{
self: ClassA with TraitA[L] =>
}
class ClassB[L] extends ClassA with TraitA[L] with TraitB[L]
有没有办法不指出TraitA中的类型,因为它似乎有关于行self: ClassA with TraitB[L] =>
中类型的足够信息
有这样的东西
class ClassA
trait TraitA[L]
trait TraitB{
self: ClassA with TraitA[L] =>
}
class ClassB[L] extends ClassA with TraitA[L] with TraitB
我可以做以下
class ClassA
trait TraitA[L]
trait TraitB{
self: ClassA with TraitA[_] =>
}
class ClassB[L] extends ClassA with TraitA[L] with TraitB
但在这种情况下,我在TraitB中失去了TraitA的类型