ficus icon indicating copy to clipboard operation
ficus copied to clipboard

Cannot generate a config value reader for type Option

Open k8 opened this issue 7 years ago • 1 comments

Ficus fails to generate a value reader in following example:

import com.typesafe.config.{Config, ConfigFactory}
import net.ceedubs.ficus.Ficus._
import net.ceedubs.ficus.readers.ArbitraryTypeReader._
import net.ceedubs.ficus.readers.ValueReader

object x {
  sealed trait A
  case object A1 extends A
  case object A2 extends A
}
case class B(b: Option[x.A])
case class C(c: Option[B])

object FicusIssue {
  implicit val aReader: ValueReader[x.A] = new ValueReader[x.A] {
    override def read(config: Config, path: String): x.A = x.A1
  }

  val c = ConfigFactory.load().as[C]("c")
}

Compile error message is: "Cannot generate a config value reader for type Option[B], because value readers cannot be auto-generated for types with type parameters. Consider defining your own ValueReader[Option[B]]"

If A, B and C are defined in the same scope compilation succeeds.

k8 avatar Sep 04 '17 13:09 k8

Any progress?

SzymonSmykala avatar Jun 07 '20 14:06 SzymonSmykala