Closed
Description
Please consider the following Type Parameter hierarchy:
sealed trait A[X] {
def foo: X
}
object A {
final case class First[Type : GenCodec](foo: Type) extends A[Type]
object First {
implicit def genCodec[Type : GenCodec]: GenCodec[First[Type]] = GenCodec.materialize
}
implicit def genCodec[T : GenCodec]: GenCodec[A[T]] = GenCodec.materialize
}
The code above compiles and works nicely. However, after turning the Type Parameter into the Type Member:
sealed trait A {
type X
def foo: X
}
object A {
final case class First[Type : GenCodec](foo: Type) extends A { type X = Type }
object First {
implicit def genCodec[Type : GenCodec]: GenCodec[First[Type]] = GenCodec.materialize
}
implicit def genCodec[T : GenCodec]: GenCodec[A { type X = T }] = GenCodec.materialize
}
the compiler claims that Cannot automatically derive GenCodec for com.avsystem.yanush.components.shared.search.model.A{type X = T}
.
Metadata
Metadata
Assignees
Labels
No labels