Flaw in algorithm? #395
Description
I'm trying to generate picklers and unpicklers for Spore
s. One problem I'm hitting is that despite having static picklers/unpicklers for a given Spore
, scala-pickling generates their own brand-new picklers/unpicklers. For instance, let's say we have this:
case class B[S](value: S)
val s: Spore[T, B[S]] = ???
implicitly[Pickler[Spore[T, B[S]]]
implicitly[Unpickler[Spore[T, B[S]]]
Types T
and S
are concrete in the call site.
The aforementioned problem appears when we don't have a Pickler
/Unpickler
for B
. Therefore, scala-pickling will infer that there's no Pickler
/Unpickler
for the spore type and generate them as well.
In my opinion, a fix for this problem is to change how the algorithm proceeds. If there's no Pickler
/Unpickler
for B
, we generate them and then check if there's now a Pickler
/Unpickler
that matches Spore[T,S]
and compose them.
If my previous analysis is not correct, this may be a problem caused by a bad registration of Pickler
s and Unpickler
s. I'm using HybridRuntime
. Also note that I am not using staticOnly
.
This only affects scala pickling v0.11.x
.