Open wedens opened 7 years ago
Also affects 2.11.11 of typelevel-4; this is how I can recreate it using circe: https://github.com/circe/circe/issues/710
It also happens in other situations, not necessarily using the deriveEncoder
function:
import io.circe.Encoder
case class Bar[C]()
trait Foo[T]
object Bar {
implicit def e0[T](implicit ev: Foo[Encoder[T]]): Encoder[T] = Encoder[Unit].contramap(_ => ())
implicit def e2[C]: Encoder[Bar[C]] = Encoder[Unit].contramap(_ => ())
implicit val e1: Encoder[Bar[String]] = Encoder[Unit].contramap(_ => ())
}
object Test {
implicitly[Encoder[Bar[String]]]
}
Removing any of e1
, e2
or e3
will fix the issue but moving any combination of them in a LowPriority
trait won't. I tried replacing Encoder
with a dummy typeclass but it didn't crash so I suspect that the issue must be caused by some more complex clash involving also the implicits already defined in the Encoder
companion object.
There's not really anything that weird about the instances that the Encoder
companion object provides—there are a couple of levels for prioritization, and there are some generic instances for collection types, but circe-core is 100% macro-free and I can't think of anything that could contribute to this.
TLS version: 2.12.2-bin-typelevel-4
Looks like this is the line with the error.