Skip to content
Permalink
Browse files

Avoid instance name collisions

  • Loading branch information...
travisbrown committed Jun 12, 2019
1 parent 6b99cb3 commit 8a27b324d22978c133d0181ecc0f66d26520febd
@@ -73,15 +73,15 @@ abstract class JsonCodecMacros {
)
} else {
val tparamNames = tparams.map(_.name)
def mkImplicitParams(typeSymbol: TypeSymbol) =
def mkImplicitParams(prefix: String, typeSymbol: TypeSymbol) =
tparamNames.zipWithIndex.map {
case (tparamName, i) =>
val paramName = TermName(s"instance$i")
val paramName = TermName(s"$prefix$i")
val paramType = tq"$typeSymbol[$tparamName]"
q"$paramName: $paramType"
}
val decodeParams = mkImplicitParams(DecoderClass)
val encodeParams = mkImplicitParams(EncoderClass)
val decodeParams = mkImplicitParams("decode", DecoderClass)
val encodeParams = mkImplicitParams("encode", EncoderClass)
val Type = tq"$tpname[..$tparamNames]"
(
q"""implicit def $decodeName[..$tparams](implicit ..$decodeParams): $DecoderClass[$Type] =

0 comments on commit 8a27b32

Please sign in to comment.
You can’t perform that action at this time.