diff options
author | Stefan Zeiger <szeiger@novocode.com> | 2016-01-27 15:56:12 +0100 |
---|---|---|
committer | Stefan Zeiger <szeiger@novocode.com> | 2016-01-27 15:56:12 +0100 |
commit | a01d8399bbe9f3c20a7e2e9ea9c38aefc2e07ff6 (patch) | |
tree | c364be3bfbf2b446b500d691da2d773ae4afb5cc /test | |
parent | ea154faf467ae27c221ba0dcd7235e1e55673c51 (diff) | |
download | scala-a01d8399bbe9f3c20a7e2e9ea9c38aefc2e07ff6.tar.gz scala-a01d8399bbe9f3c20a7e2e9ea9c38aefc2e07ff6.tar.bz2 scala-a01d8399bbe9f3c20a7e2e9ea9c38aefc2e07ff6.zip |
SI-9534 Use BoxedUnit in all cases for creating Array[Unit]
Calling `wrap` or one of the higher-dimension Array factory methods on
the `Manifest` for `Unit` led to an exception because it tried to use
`void` as a primitive type. Unlike all other primitive Scala types,
`Unit` needs to be boxed. The basic `newArray` method was not affected
by this bug because it was already special-cased. The fix is to also
special-case `arrayClass`.
Diffstat (limited to 'test')
-rw-r--r-- | test/junit/scala/reflect/ClassTag.scala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/junit/scala/reflect/ClassTag.scala b/test/junit/scala/reflect/ClassTag.scala index 90cc981fc1..49022dccda 100644 --- a/test/junit/scala/reflect/ClassTag.scala +++ b/test/junit/scala/reflect/ClassTag.scala @@ -26,4 +26,14 @@ class ClassTagTest { @Test def checkDouble = assertTrue(checkNotInt[Double] (0.toDouble)) @Test def checkBoolean = assertTrue(checkNotInt[Boolean](false)) @Test def checkUnit = assertTrue(checkNotInt[Unit] ({})) -}
\ No newline at end of file + + @Test def t9534: Unit = { + val ct = implicitly[scala.reflect.ClassTag[Unit]] + val a1 = ct.newArray(1) + a1(0) = () + val a2 = ct.wrap.newArray(1) + a2(0) = a1 + val a3 = ct.newArray2(1) + a3(0) = a1 + } +} |