The basic problem is that superTypeReader and superTypeWriter were triggering for Types T and V which were identical, meaning it was getting used even when not necessary due to import upickle.default.given increasing its implicit priority.
This PR adds a : SumOf implicit requirement to V, ensuring that superTypeReader and superTypeWriter only trigger when V is a parent sealed trait/class/enum type, won't trigger when T =:= V as a case class, and thus the .asInstanceOf[TaggedReader[T]] cast is valid
Fixes https://github.com/com-lihaoyi/upickle/issues/469
The basic problem is that
superTypeReader
andsuperTypeWriter
were triggering for TypesT
andV
which were identical, meaning it was getting used even when not necessary due toimport upickle.default.given
increasing its implicit priority.This PR adds a
: SumOf
implicit requirement toV
, ensuring thatsuperTypeReader
andsuperTypeWriter
only trigger whenV
is a parentsealed trait/class/enum
type, won't trigger whenT =:= V
as acase class
, and thus the.asInstanceOf[TaggedReader[T]]
cast is valid