Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

phase typer fails when using io.github.netvl.picopickle.backends.jawn.JsonPickler. #19

Open
thecatwhisperer opened this issue Jun 2, 2016 · 1 comment

Comments

@thecatwhisperer
Copy link

Following code results in lockup when compiling (phase typer):

case class Recipe(title: String, description: Option[String] = None, ingredients: Seq[Ingredient],
        directions: Seq[String], images: Option[Seq[String]] = None)

val baseRecipe = new Recipe(title = "A Recipe", description = Option(""), ingredients = Seq(),
    directions = Seq(), images = None)

val write1 = writeString(baseRecipe)
@netvl
Copy link
Owner

netvl commented Jun 3, 2016

Thanks, I'll look into it. Although these errors are very hard to debug and fix in Scala, unfortunately - lots of macro and implicit machinery are deeply magical and can refuse to work for no apparent reason whatsoever.

As a workaround, you can try adding explicit instantiations of Reader/Writer, like this:

object CustomPickler extends JsonPickler {
  // write here readwriters for other custom types which Ingredient depends on
  implicit val ingredientReadWriter = ReadWriter[Ingredient]
  implicit val recipeReadWriter = ReadWriter[Recipe]
}

CustomPickler.writeString(baseRecipe)

It may work but it may just as well not. Could you also please give the definition of Ingredient and other custom case classes which are transitively used by it?

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