softwaremill / diffx

Pretty diffs for scala case classes
Apache License 2.0
342 stars 30 forks source link

Comparing JSON objects causes StackOverflowError #373

Open anton-zen opened 2 years ago

anton-zen commented 2 years ago
import io.circe._, io.circe.parser._

    val rawJson: String = """
{
  "foo": "bar",
  "baz": 123,
  "list of stuff": [ 4, 5, 6 ]
}
"""

    parse(rawJson) shouldMatchTo (parse(rawJson))

Compilation error at shouldMatchTo:

method subtypes is declared as erased, but is in fact used

Scalatest output:

...
[error] dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1451)
[error] dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:991)
[error] dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:771)
[error] dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:107)
[error] dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:845)
[error] dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:771)
[error] dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:107)
[error] dotty.tools.dotc.typer.Inliner.searchImplicit$1(Inliner.scala:845)
[error] dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:852)
[error]            
[error] stack trace is suppressed; run last Test / compileIncremental for the full output
[error] (Test / compileIncremental) java.lang.StackOverflowError

Scala 3