aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/capturedVars.scala
blob: 2cbcf111ae99e25f07eb048b2b78711f148dcdf4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Test {

  var field: Int = _

  def foo() = {

    var x: Int = 1
    var y: String = "abc"
    @volatile var vx: Double = 2
    @volatile var vo: Exception = null
    var xs: Array[Int] = Array(1, 2, 3)
    val xs1: Object = xs

    def inner() = {
      field = x
      x = x + 1 + field
      y += "d"
      vx = x * 2
      vo = vo
      xs(0) = xs(1)
      xs = xs.clone
    }
  }
}