I'm having type problems. In this case, I have two traits with basic methods, and one of them depends on the other. After that, I have two implementations for them. You do not know what is wrong here?
The compiler says:
type arguments [ImplDefinition,ImplDto,ImplDtoIdentifier] do not conform to trait ChildOperations type parameter bounds [C <: Types.BaseT[A,I],A <: Types.IDObj[I],I <: IIdentifier] [error] class ImplOperations extends Parent2(new ImplDefinition) with ChildOperations[ImplDefinition, ImplDto, ImplDtoIdentifier] {
Code:
object Types { type IDObj[I <: IIdentifier] = AnyRef {def id: I} type BaseT[A, I <: IIdentifier] = Parent1[A] { def id: Foo[I] } } trait IIdentifier extends Any { def id: Long override def toString = id.toString } class Parent1[A](a: String) class Foo[A](a: String) trait ChildDefinition[A <: Types.IDObj[I], I <: IIdentifier] { self: Parent1[A] => def id(a: A): Foo[I] } class Parent2[A](a: A) trait ChildOperations[C <: Types.BaseT[A, I], A <: Types.IDObj[I], I <: IIdentifier] { self: Parent2[C] => def get(identifier: I): Option[A] } case class ImplDtoIdentifier(id: Long) extends IIdentifier case class ImplDto(id: ImplDtoIdentifier, name: String) class ImplDefinition extends Parent1[ImplDto]("Value") with ChildDefinition[ImplDto, ImplDtoIdentifier] { override def id(a: ImplDto): Foo[ImplDtoIdentifier] = ??? } class ImplOperations extends Parent2(new ImplDefinition) with ChildOperations[ImplDefinition, ImplDto, ImplDtoIdentifier] { self => override def get(identifier: ImplDtoIdentifier): Option[ImplDto] = ???
source share