summaryrefslogtreecommitdiff
path: root/test-nsc/files/pos/bug17.scala
blob: a83eefe972dbecd3b2b77c0c8277a50e2769105b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class Quantity {
    def getValue = 0;
    def connect(c: Constraint) = c.newValue;
}

abstract class Constraint(q: Quantity) {
    def newValue: Unit;
    q connect this
}

class Adder(q: Quantity) extends Constraint(q) {
    def newValue = System.out.println(q.getValue);
}

object Main {
    def main(args: Array[String]): Unit = {
        val x = new Quantity;
        new Adder(x);
        ()
    }
}