softwaremill / magnolia

Easy, fast, transparent generic derivation of typeclass instances
https://softwaremill.com/open-source/
Apache License 2.0
754 stars 116 forks source link

"Internal error: unable to find the outer accessor symbol of ..." when deriving instance for a nested type #449

Open notxcain opened 1 year ago

notxcain commented 1 year ago

Version: 1.12

Reproducer: https://scastie.scala-lang.org/lZwX8BQSThWjL8sEAnSPnw

adamw commented 1 year ago

Seems to be a problem with a combination of classes defined in traits + default field values

notxcain commented 1 year ago

Yes, but it works if you put derivation inside the companion.

trait X {
  case class F(i: Int = 5)
  object F {
    implicit def tc: TC[F] = TC.derive[F]
  }
}