diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index 996c480ce778..36d75b149c54 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -119,7 +119,7 @@ object Erasure extends TypeTestsCasts{ object Boxing { def isUnbox(sym: Symbol)(implicit ctx: Context) = - sym.name == nme.unbox && (defn.ScalaBoxedClasses contains sym.owner.linkedClass) + sym.name == nme.unbox && (defn.ScalaValueClasses contains sym.owner.linkedClass) def isBox(sym: Symbol)(implicit ctx: Context) = sym.name == nme.box && (defn.ScalaValueClasses contains sym.owner.linkedClass) diff --git a/tests/pos/nullAsInstanceOf.scala b/tests/pos/nullAsInstanceOf.scala deleted file mode 100644 index 2662df72eb85..000000000000 --- a/tests/pos/nullAsInstanceOf.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test { - val b = null.asInstanceOf[Byte] - val c = null.asInstanceOf[Char] - val s = null.asInstanceOf[Short] - val i = null.asInstanceOf[Int] - val l = null.asInstanceOf[Long] - val f = null.asInstanceOf[Float] - val d = null.asInstanceOf[Double] - - val str = null.asInstanceOf[String] -} diff --git a/tests/run/nullAsInstanceOf.check b/tests/run/nullAsInstanceOf.check new file mode 100644 index 000000000000..3cc997cd79e8 Binary files /dev/null and b/tests/run/nullAsInstanceOf.check differ diff --git a/tests/run/nullAsInstanceOf.scala b/tests/run/nullAsInstanceOf.scala new file mode 100644 index 000000000000..7924ff833580 --- /dev/null +++ b/tests/run/nullAsInstanceOf.scala @@ -0,0 +1,23 @@ +object Test { + def main(args: Array[String]): Unit = { + val u = null.asInstanceOf[Unit] + val b = null.asInstanceOf[Byte] + val c = null.asInstanceOf[Char] + val s = null.asInstanceOf[Short] + val i = null.asInstanceOf[Int] + val l = null.asInstanceOf[Long] + val f = null.asInstanceOf[Float] + val d = null.asInstanceOf[Double] + val str = null.asInstanceOf[String] + + println(u) + println(b) + println(c) + println(s) + println(i) + println(l) + println(f) + println(d) + println(str) + } +}