Skip to content
This repository was archived by the owner on Feb 20, 2019. It is now read-only.
This repository was archived by the owner on Feb 20, 2019. It is now read-only.

Flaw in algorithm? #395

Open
Open
@jvican

Description

@jvican

I'm trying to generate picklers and unpicklers for Spores. 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 Picklers and Unpicklers. I'm using HybridRuntime. Also note that I am not using staticOnly.

This only affects scala pickling v0.11.x.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions