suzaku-io / boopickle

Binary serialization library for efficient network communication

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compositePickler.addConcreteType inside class does not compile

fdietze opened this issue · comments

Hi, this compiles:

sealed trait F
case object A extends F
implicit def fp = compositePickler[F].addConcreteType[A.type]

while this does not:

class X {
  sealed trait F
  case object A extends F
  implicit def fp = compositePickler[F].addConcreteType[A.type]
}
error:
<macro>:1: error: value X is not a member of object $iw
 Note: implicit method fp is not applicable here because it comes after the application point and it lacks an explicit result type
X.A
                                  ^

Is this expected behavior or a bug?

First of all you should never have a pickler defined with implicit def because that will regenerate the pickler every time it's used :)

Otherwise it's probably a duplicate of #29