diff options
author | James Iry <jamesiry@gmail.com> | 2013-01-14 11:24:11 -0800 |
---|---|---|
committer | James Iry <jamesiry@gmail.com> | 2013-01-15 10:48:22 -0800 |
commit | 765386ff970af8d53aaa66a42b030e83043d471d (patch) | |
tree | 9c3d9cff76fc2e989890e9a88a829dc8596657ee /test/files | |
parent | 621f7a56c21686ebbd39b8ffe9282f917fe1f128 (diff) | |
download | scala-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')
-rw-r--r-- | test/files/run/t5568.check | 9 | ||||
-rw-r--r-- | test/files/run/t5568.scala | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/test/files/run/t5568.check b/test/files/run/t5568.check new file mode 100644 index 0000000000..67aaf16e07 --- /dev/null +++ b/test/files/run/t5568.check @@ -0,0 +1,9 @@ +void +int +class scala.runtime.BoxedUnit +class scala.runtime.BoxedUnit +class java.lang.Integer +class java.lang.Integer +5 +5 +5 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).##) + } +} |