aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2015-02-13 14:31:58 +0100
committerDmitry Petrashko <dark@d-d.me>2015-02-13 14:31:58 +0100
commit2e72811fb1cedb94c7967acf96c92172f010a20b (patch)
tree621fd55bf3967fe734d0192cb491ab0e01bc627b /tests
parentc12f21306ea01bd0411f07074a5a0637f23187ff (diff)
parent37c2dcc2268e6840cfcd89fc5937d461a493e1fd (diff)
downloaddotty-2e72811fb1cedb94c7967acf96c92172f010a20b.tar.gz
dotty-2e72811fb1cedb94c7967acf96c92172f010a20b.tar.bz2
dotty-2e72811fb1cedb94c7967acf96c92172f010a20b.zip
Merge pull request #359 from dotty-staging/fix/erasure-lub-alternative
Fix/erasure lub alternative
Diffstat (limited to 'tests')
-rw-r--r--tests/pos/erased-lub.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/pos/erased-lub.scala b/tests/pos/erased-lub.scala
new file mode 100644
index 000000000..d3d2183c1
--- /dev/null
+++ b/tests/pos/erased-lub.scala
@@ -0,0 +1,27 @@
+// Verify that expressions below perform correct boxings in erasure.
+object Test {
+ def id[T](t: T) = t
+
+ val x = true
+ val one = 1
+
+ { if (x) id(one) else 0 } + 1
+
+ { if (x) new scala.util.Random()}.asInstanceOf[Runnable]
+
+ { x match {
+ case true => id(one)
+ case _ => 0
+ }
+ } + 1
+
+ { try {
+ id(one)
+ } catch {
+ case ex: Exception => 0
+ }
+ }.asInstanceOf[Runnable]
+
+ val arr = Array(id(one), 0)
+
+}