Open
Description
Compiler version
3.1.0
Minimized code
val t1 = ( 1, 2L, 3.0f, 4.0, "five", '6' )
val csvStandard = ("1", "2", "3.0", "4.0", "\"five\"", "6" )
inline def toCSV: [t] => t => String = [t] => (x: t) => x match {
case x: String => s"\"$x\""
case x:_ => x.toString
}
val t1o3 = t1.map[[t] =>> String](toCSV)
println(t1o3)
works and prints
(1,2,3.0,4.0,"five",6)
But this does not (inline match):
val t1 = ( 1, 2L, 3.0f, 4.0, "five", '6' )
val csvStandard = ("1", "2", "3.0", "4.0", "\"five\"", "6" )
inline def toCSV: [t] => t => String = [t] => (x: t) => x match {
case x: String => s"\"$x\""
case x:_ => x.toString
}
val t1o3 = t1.map[[t] =>> String](toCSV)
println(t1o3)
Output
In the case above I get:
(1,2,3.0,4.0,five,6)
It seems like no type information is available for use. The default case is used.
Expectation
I was expecting to have the same output. If this is to be expected then I have seen several open issues regarding matching tuples inline, but cannot say if this is the same issue.
Note: I tried to create scastie example but failed due to a compilation error on the latest and RC versions.