amnaredo / test

0 stars 0 forks source link

derive calls writeJs and hard-codes a dependency on upickle #165

Open amnaredo opened 2 years ago

amnaredo commented 2 years ago

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)"
          }
        }

(https://github.com/lihaoyi/upickle-pprint/blob/master/derive/shared/src/main/scala/derive/Derive.scala#L317)

Hard-coding the call to writeJs means that derive won't derive type class instances if this method doesn't exist.

ID: 143 Original Author: jppellet

amnaredo commented 2 years ago

lol

not sure what else to say, we should fix it :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue:

Original Author: lihaoyi