When wrapping the default value of case class arguments in JSON values, derive does this:
val defaults = argSyms.zipWithIndex.map { case (s, i) =>
val defaultName = newTermName("apply$default$" + (i + 1))
companion.tpe.member(defaultName) match {
case NoSymbol => q"null"
case _ => q"${c.prefix}.writeJs($companion.$defaultName)"
}
}
When wrapping the default value of case class arguments in JSON values,
derive
does this:(https://github.com/lihaoyi/upickle-pprint/blob/master/derive/shared/src/main/scala/derive/Derive.scala#L317)
Hard-coding the call to
writeJs
means thatderive
won't derive type class instances if this method doesn't exist.ID: 143 Original Author: jppellet