diff options
author | James Iry <jamesiry@gmail.com> | 2013-03-15 08:28:35 -0700 |
---|---|---|
committer | James Iry <jamesiry@gmail.com> | 2013-03-15 08:28:35 -0700 |
commit | 25aabc80c9f07bc75ad5b24d48b14f0911544eca (patch) | |
tree | 732f708f4438fea75079c11bece36a38ec0198f0 /test/files/jvm/constant-optimization/Foo_1.scala | |
parent | 482bef8079e2a2fecc2b8f77eb7c6da648125e3c (diff) | |
parent | 3a17ff00067f8f11288b1ddc778e193bed3ea017 (diff) | |
download | scala-25aabc80c9f07bc75ad5b24d48b14f0911544eca.tar.gz scala-25aabc80c9f07bc75ad5b24d48b14f0911544eca.tar.bz2 scala-25aabc80c9f07bc75ad5b24d48b14f0911544eca.zip |
Merge pull request #2214 from JamesIry/master_constant_optimization
Analyze constants to remove unnecessary branches
Diffstat (limited to 'test/files/jvm/constant-optimization/Foo_1.scala')
-rw-r--r-- | test/files/jvm/constant-optimization/Foo_1.scala | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/files/jvm/constant-optimization/Foo_1.scala b/test/files/jvm/constant-optimization/Foo_1.scala new file mode 100644 index 0000000000..cb67ad4e90 --- /dev/null +++ b/test/files/jvm/constant-optimization/Foo_1.scala @@ -0,0 +1,9 @@ +class Foo_1 { + def foo() { + // constant optimization should eliminate all branches + val i = 1 + val x = if (i != 1) null else "good" + val y = if (x == null) "good" else x + "" + println(y) + } +}
\ No newline at end of file |