-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Milestone
Description
scala> null.asInstanceOf[Double]
res0: Double = 0.0
scala> null.asInstanceOf[Double] == null
<console>:11: warning: comparing values of types Double and Null using `==' will always yield false
null.asInstanceOf[Double] == null
^
res1: Boolean = true
scala> 0.0 == null
<console>:11: warning: comparing values of types Double and Null using `==' will always yield false
0.0 == null
^
res2: Boolean = false
scala> null.asInstanceOf[Double] == 0.0
res6: Boolean = true
scala> val a = null.asInstanceOf[Double]
a: Double = 0.0
scala> a == null
<console>:12: warning: comparing values of types Double and Null using `==' will always yield false
a == null
^
res7: Boolean = false
Same for Int and Long.
At least, the warning message seems incorrect, regardless that the boxing/unboxing logic might be fine (?)