diff options
-rw-r--r-- | test/files/pos/bug17.scala | 21 | ||||
-rw-r--r-- | test/pos/bug17.scala | 21 |
2 files changed, 42 insertions, 0 deletions
diff --git a/test/files/pos/bug17.scala b/test/files/pos/bug17.scala new file mode 100644 index 0000000000..a83eefe972 --- /dev/null +++ b/test/files/pos/bug17.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 = System.out.println(q.getValue); +} + +object Main { + def main(args: Array[String]): Unit = { + val x = new Quantity; + new Adder(x); + () + } +} diff --git a/test/pos/bug17.scala b/test/pos/bug17.scala new file mode 100644 index 0000000000..a83eefe972 --- /dev/null +++ b/test/pos/bug17.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 = System.out.println(q.getValue); +} + +object Main { + def main(args: Array[String]): Unit = { + val x = new Quantity; + new Adder(x); + () + } +} |