diff options
Diffstat (limited to 'tests/pos/t0017.scala')
-rw-r--r-- | tests/pos/t0017.scala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/pos/t0017.scala b/tests/pos/t0017.scala new file mode 100644 index 000000000..d2bcda08d --- /dev/null +++ b/tests/pos/t0017.scala @@ -0,0 +1,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 = Console.println(q.getValue); +} + +object Main { + def main(args: Array[String]): Unit = { + val x = new Quantity; + new Adder(x); + () + } +} |