summaryrefslogblamecommitdiff
path: root/test/files/run/constant-optimization.scala
blob: 86f981e13f7f938fa9ee7827f7cdc0ce2ba78a94 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                             
object Test extends App {
  def testBothReachable() {
    val i = util.Random.nextInt
    val x = if (i % 2 == 0) null else "good"
    val y = if (x == null) "good" else x + ""
    println(s"testBothReachable: $y")
  }

  def testOneReachable() {
    val i = 1
    val x = if (i != 1) null else "good"
    val y = if (x == null) "good" else x + ""
    println(s"testOneReachable: $y")
  }

  testBothReachable()
  testOneReachable()
}