-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
scala/scala
#9641Milestone
Description
reproduction steps
using Scala 2.13.6,
Welcome to Scala 2.13.6 (OpenJDK 64-Bit Server VM, Java 1.8.0_232).
Type in expressions for evaluation. Or try :help.
scala> Array.empty[Double].intersect(Array(0.0))
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [D
... 32 elided
scala> Array(0.0).intersect(Array.empty[Double])
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [D
... 32 elided
scala> Array.empty[Double].intersect(Array.empty[Double])
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [D
... 32 elidedbut using Scala 2.13.5
Welcome to Scala 2.13.5 (OpenJDK 64-Bit Server VM, Java 1.8.0_232).
Type in expressions for evaluation. Or try :help.
scala> Array.empty[Double].intersect(Array(0.0))
val res0: Array[Double] = Array()
scala> Array(0.0).intersect(Array.empty[Double])
val res1: Array[Double] = Array()
scala> Array.empty[Double].intersect(Array.empty[Double])
val res2: Array[Double] = Array()problem
There are behavior changes of intersect operations related to Array.empty[T], return Array() is replaced by throw ClassCastException, Is this expected or a bug?
Reactions are currently unavailable