tek / splain

better implicit errors for scala
MIT License
370 stars 28 forks source link

Diverging Implicit error in compact tree mode (without specifying `Vimplicits-verbose-tree`) reports some errors as "unlinked", while in reality they are just compacted #88

Closed tribbloid closed 2 years ago

tribbloid commented 2 years ago

In the following unit test:

object DivergingImplicits {

  type C
  type D

  object Diverging {
    trait ::[A, B]

    implicit def f[A, B](
        implicit
        ii: Int :: A :: B
    ): A :: B = ???

    implicit def g[A, B]: Int :: Int :: Int :: A :: B = ???

    implicitly[C :: D]
  }
}

If we invoke splain without the Vimplicits-verbose-tree option, it will throw the following error:

newSource1.scala:16: error: implicit error;
!I e: DivergingImplicits.C :: DivergingImplicits.D
Diverging.f invalid because
!I ii: scala.Int :: DivergingImplicits.C :: DivergingImplicits.D
⋮
――Diverging.f invalid because
  !I ii:
    scala.Int ::
    scala.Int ::
    scala.Int ::
    DivergingImplicits.C ::
    DivergingImplicits.D
  diverging implicit expansion for type (scala.Int :: scala.Int :: scala.Int :: DivergingImplicits.C :: DivergingImplicits.D)
  starting with method g in object Diverging
[WARNING] The following reported error(s) cannot be linked to any part of the implicit search tree:
――diverging implicit expansion for type (scala.Int :: scala.Int :: DivergingImplicits.C :: DivergingImplicits.D)
starting with method f in object Diverging
    implicitly[C :: D]
              ^

The last part, starting from [WARNING] should totally be removed, as this is the error omitted in the ⋮ section.

tribbloid commented 2 years ago

Patch will come shortly

tribbloid commented 2 years ago

Patch out

tribbloid commented 2 years ago

merged, closing