circe icon indicating copy to clipboard operation
circe copied to clipboard

Error message when deriving for List[A] in Scala 3 needs improvement

Open heksesang opened this issue 3 years ago • 2 comments

Currently, when you try to either derive Encoder[List[A]] directly (by deriveEncoder[List[A]]) or indirectly (by deriving for a type that contains a List[A]) with semiauto and there doesn't exist an Encoder[A], you get an error message that really isn't all that helpful:

Maximal number of successive inlines (32) exceeded,
Maybe this is caused by a recursive inline method?
You can use -Xmax-inlines to change the limit.

The problem here is that the Scala 3 derivation code tries to auto-derive Encoder[List[A]] (which is insane) when it cannot use Encoder.encodeList[A] because of missing Encoder[A].

Here is a scastie example showing it off: https://scastie.scala-lang.org/heksesang/z1VPL9zST2S9tmRwMz5oJg/1

heksesang avatar Mar 14 '21 13:03 heksesang

Can repro, I tried to get around it temporarily by increasing max inlines but got StackOverflow.

broman avatar May 06 '22 04:05 broman

Any updates on this?

ecastilla95 avatar Aug 31 '22 12:08 ecastilla95