aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-13 22:02:56 +0100
committerMartin Odersky <odersky@gmail.com>2017-03-13 22:03:06 +0100
commite33ad95fd8e31c80f3615e6feb11d7e583723dd8 (patch)
tree75cdc8ac314d1f7b24b2130a44f39b8fd436ed97 /tests
parent921f8bffc18b19449b2c1ad68c32725a7b7532e2 (diff)
downloaddotty-e33ad95fd8e31c80f3615e6feb11d7e583723dd8.tar.gz
dotty-e33ad95fd8e31c80f3615e6feb11d7e583723dd8.tar.bz2
dotty-e33ad95fd8e31c80f3615e6feb11d7e583723dd8.zip
Fix #2077: Optimization of constant conditionals
Move fixed logic to FirstTransform, where the other constant folding operations are also done.
Diffstat (limited to 'tests')
-rw-r--r--tests/run/i2077.check1
-rw-r--r--tests/run/i2077.scala10
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/run/i2077.check b/tests/run/i2077.check
new file mode 100644
index 000000000..45b983be3
--- /dev/null
+++ b/tests/run/i2077.check
@@ -0,0 +1 @@
+hi
diff --git a/tests/run/i2077.scala b/tests/run/i2077.scala
new file mode 100644
index 000000000..42b629b90
--- /dev/null
+++ b/tests/run/i2077.scala
@@ -0,0 +1,10 @@
+object Test {
+ inline val x = true
+ val y = if (x) 1 else 2 // reduced to val y = 1
+
+ def main(args: Array[String]): Unit =
+ if ({ println("hi"); true }) // cannot be reduced
+ 1
+ else
+ 2
+}