Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenCodec.materialize fails for Type Members and works for Type Parameters #67

Closed
bgrochal opened this issue Jun 11, 2018 · 1 comment
Closed

Comments

@bgrochal
Copy link
Member

bgrochal commented Jun 11, 2018

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}.

@ghik
Copy link
Contributor

ghik commented Jun 13, 2018

Fixed in 1.28.0

@ghik ghik closed this as completed Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants