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
inlinedefflatConcat2[A, B](a: A, b: B) =
b matchcasebs: *:[bh, bt] => a *: bs
valx: (Int, Int, Int) = flatConcat2(1, (2,3))
Output
java.lang.ClassCastException: class scala.Tuple3 cannot be cast to class scala.Tuple1 (scala.Tuple3 and scala.Tuple1 are in unnamed module of loader sbt.internal.ScalaLibraryClassLoader @3401c1d7)
pointing to the end of the flatConcat2 definition
Expectation
This works if the inline is removed
Should not throw a ClassCastException.
Note, the match type of the def is:
type FlatConcat2[A, B] = B match
case b *: bs => A *: b *: bs