aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-03-14 14:04:41 +0100
committerGitHub <noreply@github.com>2017-03-14 14:04:41 +0100
commitc7acb7bbb296237dc56ea8d124d6ad4a8dbb7003 (patch)
tree909daf9beb84babf7b167fd0ab0f15aabac7a77c /tests
parent3a93b3ee128bae804044b25aa7354ce32e074678 (diff)
parente33ad95fd8e31c80f3615e6feb11d7e583723dd8 (diff)
downloaddotty-c7acb7bbb296237dc56ea8d124d6ad4a8dbb7003.tar.gz
dotty-c7acb7bbb296237dc56ea8d124d6ad4a8dbb7003.tar.bz2
dotty-c7acb7bbb296237dc56ea8d124d6ad4a8dbb7003.zip
Merge pull request #2091 from dotty-staging/fix-#2077
Fix #2077: Optimization of constant conditionals
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
+}