@@ -65,23 +65,24 @@ trait LowPriorityMacros {
6565 val fieldType = field.typeSignature
6666 val fieldTerm = field.asTerm
6767
68- val fieldEncodeExpression =
69- q " _root_.scala.Predef.implicitly[ ${fieldType}].encode(value. ${fieldTerm}, os) "
70-
71- val fieldDecodeExpression =
72- q " ${field.asTerm} = _root_.scala.Predef.implicitly[Coder[ ${fieldType}]].decode(is) "
73-
74- val innerType = field.typeSignature.finalResultType // inneryType is String
75- val typeClassType : Type = typeOf(typeTag[Coder [T ]]) // typeClassType is Coder[T]
68+ val innerType = field.typeSignature.finalResultType // inneryType for field is String (we call it F)
69+ val typeClassType : Type = typeOf(typeTag[Coder [innerType.type ]]) // FIXME typeClassType is Coder[F], not T
7670 val appliedFieldType = appliedType(typeClassType, innerType) // we need Coder[String]
7771
7872 val foundFieldImplicitCoder = c.inferImplicitValue(appliedFieldType)
7973 val fieldImplicitCoderExpression =
8074 if (foundFieldImplicitCoder.isEmpty) {
8175 c.abort(c.enclosingPosition, s " Implicit search failed for ${appliedFieldType}" )
8276 } else {
83- q " val ${TermName (c.freshName())}: ${innerType } = ${foundFieldImplicitCoder}"
77+ q " implicit val ${TermName (c.freshName())}: ${appliedFieldType } = ${foundFieldImplicitCoder}"
8478 }
79+
80+ val fieldEncodeExpression = // FIXME use found coder here instead of implicitly
81+ q " _root_.scala.Predef.implicitly[Coder[ ${fieldType}]].encode(value. ${fieldTerm}, os) "
82+
83+ val fieldDecodeExpression = // FIXME user found coder here instead of implicitly
84+ q " ${field.asTerm} = _root_.scala.Predef.implicitly[Coder[ ${fieldType}]].decode(is) "
85+
8586 (fieldEncodeExpression, fieldDecodeExpression, fieldImplicitCoderExpression)
8687 }
8788
0 commit comments