You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sealedtraitTopobjectTop// companion is necessarycaseclassMiddle() extendsTopwithBottomsealedtraitBottomextendsTop
compile with Scala 3.1.0 and with out on classpath
valm= summon[deriving.Mirror.SumOf[Top]]
Output
runtime error:
java.lang.ClassCastException:Top$ cannot be cast to scala.deriving.Mirror$Sum
... 28 elided
This happens because Top is an eligible sum, and it has a companion object (which if compiled by Scala 3.1.0 would extend deriving.Mirror.Sum), so the companion object is used as the mirror and is cast to Sum.
Expectation
prevent summoning mirrors for hierarchical sums with companion objects compiled before 3.1.0