-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)patmattyper
Milestone
Description
The second result type should be Int
def f1(l: Array[Int]): Array[Any] =
l.map{ x =>
x match {
case x if x == 1 => x.toString
case x if x == 2 => x.toInt
case _ => x.toDouble
}
}
f1(Array(1,2,3)).foreach(v => println(s"$v :${v.getClass}"))
1 :class java.lang.String
2.0 :class java.lang.Double
3.0 :class java.lang.DoubleMetadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)patmattyper