I need help with Scala's Generics.
I have the following "abstract" traits:
trait Base[B <: Base[B,M], M <: Meta[B,M]] { def meta: M } // Manages instances of a general type trait Meta[B <: Base[B,M], M <: Meta[B,M]] { // ... } // Manages Metas of a general type trait Manager[M <: Meta[_,M]] { def apply[N <: M](clazz: Class[N]): N } Then I wan to define some more specific type hierarchy like this:
trait Thing[B <: Thing[B,M], M <: ThingMeta[B,M]] extends Base[B,M] { // ... } trait ThingMeta[B <: Thing[B,M], M <: ThingMeta[B,M]] extends Meta[B,M]{ // ... } trait ThingManager extends *Manager[ThingMeta[_,_]]* { // ... } The last declaration gives me this error:
type arguments [ThingMeta[_, _]] do not conform to trait Manager's type parameter bounds [M <: Meta[_, M]] How can I say that ThingManager, is a Manager for all ThingMetas, and therefore does not itself take a type parameter.