aboutsummaryrefslogtreecommitdiff
path: root/tests/run/optimizer-array-load.scala
blob: a4d76f73853a750b34f1024d05939d748f79f8e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
object Test {
  def f() = {
    val ar = Array.ofDim[Int](5)
    var x = 0

    while (x<=5) {
      println(x)
      val a = ar(x)
      x+=1
    }
  }
  def main(args: Array[String]): Unit = {
    try   { f() ; assert(false, "should have thrown exception") }
    catch { case _: ArrayIndexOutOfBoundsException => () }
  }
}