8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This simple recursive data structure fails to derive an Encoder:
sealed trait Tree; case class Branch(l: Tree, r: Tree) extends Tree; case object Leaf extends Tree;
With this error:
Welcome to Scala 3.2.2 (17.0.6, Java OpenJDK 64-Bit Server VM). Type in expressions for evaluation. Or try :help. scala> import _root_.io.circe._ scala> sealed trait Tree; case class Branch(l: Tree, r: Tree) extends Tree; case object Leaf extends Tree;;Encoder.AsObject.derived[Tree] -- Error: ---------------------------------------------------------------------- 1 |sealed trait Tree; case class Branch(l: Tree, r: Tree) extends Tree; case object Leaf extends Tree;;Encoder.AsObject.derived[Tree] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 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. |--------------------------------------------------------------------------- |Inline stack trace |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |This location contains code that was inlined from rs$line$2:1 20 | case _: Mirror.Of[A] => ConfiguredEncoder.derived[A] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |This location contains code that was inlined from rs$line$2:1 15 | case _: (t *: ts) => summonEncoder[t] :: summonEncoders[ts] | ^^^^^^^^^^^^^^^^ |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |This location contains code that was inlined from rs$line$2:1 32 | lazy val elemEncoders: List[Encoder[?]] = summonEncoders[mirror.MirroredElemTypes] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |This location contains code that was inlined from rs$line$2:1 20 | case _: Mirror.Of[A] => ConfiguredEncoder.derived[A] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |This location contains code that was inlined from rs$line$2:1 15 | case _: (t *: ts) => summonEncoder[t] :: summonEncoders[ts] | ^^^^^^^^^^^^^^^^ |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |This location contains code that was inlined from rs$line$2:1 32 | lazy val elemEncoders: List[Encoder[?]] = summonEncoders[mirror.MirroredElemTypes] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |This location contains code that was inlined from rs$line$2:1 20 | case _: Mirror.Of[A] => ConfiguredEncoder.derived[A] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |This location contains code that was inlined from rs$line$2:1 15 | case _: (t *: ts) => summonEncoder[t] :: summonEncoders[ts] | ^^^^^^^^^^^^^^^^ |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |This location contains code that was inlined from rs$line$2:1 32 | lazy val elemEncoders: List[Encoder[?]] = summonEncoders[mirror.MirroredElemTypes] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .........
The text was updated successfully, but these errors were encountered:
A better option would be enabling derivation of codecs for recursive ADTs by configuration, and have it turned off by default for the security reason.
Malicious counterparts can submit too deeply nested JSON that will DoS systems opened to untrusted input by stack overflows.
Sorry, something went wrong.
If the implementation does not cause stack overflow there is no need to have a configuration for it.
Improve derivation support for recursive ADTs
48d42c8
Fixes circe#2101
Successfully merging a pull request may close this issue.
This simple recursive data structure fails to derive an Encoder:
With this error:
The text was updated successfully, but these errors were encountered: