milessabin / shapeless

Generic programming for Scala
Apache License 2.0
3.4k stars 533 forks source link

Auxiliary constructors with configured codecs #1372

Closed 491426 closed 2 months ago

491426 commented 2 months ago

When using circe to decode a class, having an auxiliary constructor produces an error. The circe folks traced this to a shapeless error: https://github.com/circe/circe/issues/1129.

scala> case class Qux() defined class Qux

scala> case class Foo(i: Int) defined class Foo

scala> case class Bar(i: Int) { def this() = this(0) } defined class Bar

scala> shapeless.Annotations[Qux, Foo] res0: shapeless.Annotations[Qux,Foo]{type Out = None.type :: shapeless.HNil} = shapeless.Annotations$$anon$1@577d35bc

scala> shapeless.Annotations[Qux, Bar]

:16: error: could not find implicit value for parameter annotations: shapeless.Annotations[Qux,Bar] shapeless.Annotations[Qux, Bar] ^