Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot generate a config value reader for type Option #52

Open
k8 opened this issue Sep 4, 2017 · 1 comment
Open

Cannot generate a config value reader for type Option #52

k8 opened this issue Sep 4, 2017 · 1 comment

Comments

@k8
Copy link

k8 commented Sep 4, 2017

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.

@SzymonSmykala
Copy link

Any progress?

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

No branches or pull requests

2 participants