Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Semi-auto derivation fails for reference to type with self-extension #237

Open
cocreature opened this issue May 5, 2021 · 1 comment
Open

Comments

@cocreature
Copy link

The example below fails with the following error:

debug/Debug.scala:18: error: magnolia: could not find Diff.Typeclass for type Option[foobar.Debug.A]
    in parameter 'id' of product type foobar.Debug.B

  implicit val diffB: Derived[Diff[B]] = Diff.derived[B]

Versions:

  • diffx: 0.4.5
  • Magnolia: 0.17.0
  • Mercator: 0.3.0
  • Scala 2.13.5 but also reproduces on 2.12.13
package foobar

import com.softwaremill.diffx._

object Debug {

  // This is scalapb.Message in real code.
  trait T[C]

  // Removing the inheritance makes it compile.
  final case class A() extends T[A]

  final case class B(id: Option[A])
  implicit val diffA: Derived[Diff[A]] = Diff.derived[A]
  implicit val diffB: Derived[Diff[B]] = Diff.derived[B]
  // Fails with: error: magnolia: could not find Diff.Typeclass for type Option[foobar.Debug.Identifier]
}

The issue goes away when removing the extension of T but as mentioned in the comment this comes from generated ScalaPb code so this is not an option.

@ghostbuster91
Copy link
Collaborator

Hi,

Thanks for the report and sorry for the long delay.
On the first glance it seems like the problem on the magnolia site.

I will try to confirm that in the upcoming week, but I doubt that it will be fixed shortly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants