aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/opassign.scala
blob: 8f6cad903a276f22b287231abccc908473c758a0 (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
26
27
28
object opassign {

  var count: Int = 0

  def next = { count += 1; count }

  var x: Int = 0
  x += 1

  { var x: Int = 0
    x += 1
  }

  class Ref {
    var x: Int = _
  }
  val r = new Ref
  r.x += 1

  val arr = new Array[Int](10)
  arr(0) += 1

  def f(x: Int): Ref = new Ref
  f(next).x += 1

  val buf = new collection.mutable.ListBuffer[Int]
  buf += 1
}