summaryrefslogtreecommitdiff
path: root/test/files/neg/t963b.scala
blob: b34aae8095ae4ccd034a6d912b62e95526139b20 (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
// Soundness bug, at #963 and dup at #2079.
trait A {
  type T
  var v : T
}

object B {
  def f(x : { val y : A }) { x.y.v = x.y.v }

  var a : A = _
  var b : Boolean = false
  def y : A = {
    if(b) {
      a = new A { type T = Int; var v = 1 }
      a
    } else {
      a = new A { type T = String; var v = "" }
      b = true
      a
    }
  }
}

object Test extends App {
  B.f(B)
}