summaryrefslogtreecommitdiff
path: root/test/files/run/t8233.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-02-04 17:44:09 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-02-05 08:44:45 +0100
commit9506d5273b4b10037c202f01e8556076998bd064 (patch)
treeeb2460ab4c122926e537d81e2fce03af37e3569e /test/files/run/t8233.scala
parenteba3cc6a9e4bb091db3cc7d68dc64abb803f52c7 (diff)
downloadscala-9506d5273b4b10037c202f01e8556076998bd064.tar.gz
scala-9506d5273b4b10037c202f01e8556076998bd064.tar.bz2
scala-9506d5273b4b10037c202f01e8556076998bd064.zip
SI-8233 Fix regression in backend with boxed nulls
Regressed in SI-7015 / 1b6661b8. We do need to "unbox" the null (ie, drop a stack from and load a null) in general. The only time we can avoid this is if the tree we are adapting is a `Constant(Literal(null))`. I've added a test for both backends. Only GenICode exhibited the problem.
Diffstat (limited to 'test/files/run/t8233.scala')
-rw-r--r--test/files/run/t8233.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/t8233.scala b/test/files/run/t8233.scala
new file mode 100644
index 0000000000..fae1c2b702
--- /dev/null
+++ b/test/files/run/t8233.scala
@@ -0,0 +1,18 @@
+object Test {
+ def bar(s: String) = s;
+ val o: Option[Null] = None
+ def nullReference {
+ val a: Null = o.get
+ bar(a) // Was: VerifyError under GenICode
+ }
+
+ def literal {
+ val a: Null = null
+ bar(a)
+ }
+
+ def main(args: Array[String]) = {
+ try { nullReference } catch { case _: NoSuchElementException => }
+ literal
+ }
+}