pbdirect icon indicating copy to clipboard operation
pbdirect copied to clipboard

Wrong deserialization for coproducts with empty lists

Open vovapolu opened this issue 5 years ago • 0 comments

import pbdirect._

sealed trait Foo

case class Foo1(li: List[Int])
case class Foo2(ll: List[Long])
import cats.instances.list._

println(Foo1(List.empty).toPB.toSeq)
println(Foo2(List.empty).toPB.toSeq)

// prints
// WrappedArray()
// WrappedArray()

So in general (a: A).toPb.pbTo[A] == a can be false

vovapolu avatar Mar 12 '19 10:03 vovapolu