summaryrefslogtreecommitdiff
path: root/test/files/run/t5568.scala
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-01-14 11:24:11 -0800
committerJames Iry <jamesiry@gmail.com>2013-01-15 10:48:22 -0800
commit765386ff970af8d53aaa66a42b030e83043d471d (patch)
tree9c3d9cff76fc2e989890e9a88a829dc8596657ee /test/files/run/t5568.scala
parent621f7a56c21686ebbd39b8ffe9282f917fe1f128 (diff)
downloadscala-765386ff970af8d53aaa66a42b030e83043d471d.tar.gz
scala-765386ff970af8d53aaa66a42b030e83043d471d.tar.bz2
scala-765386ff970af8d53aaa66a42b030e83043d471d.zip
SI-5568 Fixes verify error from getClass on refinement of value type
().asInstanceOf[AnyRef with Unit].getClass and 5.asInstanceOf[AnyRef with Int].getClass would cause a verify error. Going the other way, i.e. [Unit with AnyRef] or [Int with AnyRef] worked fine. This commit fixes it that both directions work out to BoxedUnit or java.lang.Integer.
Diffstat (limited to 'test/files/run/t5568.scala')
-rw-r--r--test/files/run/t5568.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/t5568.scala b/test/files/run/t5568.scala
new file mode 100644
index 0000000000..7fc51fe86f
--- /dev/null
+++ b/test/files/run/t5568.scala
@@ -0,0 +1,18 @@
+object Test {
+ final val UNIT: AnyRef with Unit = ().asInstanceOf[AnyRef with Unit]
+
+ def main(args: Array[String]): Unit = {
+ // these should give unboxed results
+ println(().getClass)
+ println(5.getClass)
+ // these should give boxed results
+ println(().asInstanceOf[AnyRef with Unit].getClass)
+ println(().asInstanceOf[Unit with AnyRef].getClass)
+ println(5.asInstanceOf[AnyRef with Int].getClass)
+ println(5.asInstanceOf[Int with AnyRef].getClass)
+ //make sure ## wasn't broken
+ println(5.##)
+ println((5.asInstanceOf[AnyRef]).##)
+ println((5:Any).##)
+ }
+}