Closed
Description
Compiler version
3.1.3-RC4, 3.2.0-RC1-bin-20220526-1ea177d-NIGHTLY-git-1ea177d
Minimized code
inline def flatConcat2[A, B](a: A, b: B) =
b match
case bs: *:[bh, bt] => a *: bs
val x: (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
but adding that does not change anything