summaryrefslogtreecommitdiff
path: root/test-nsc/files/pos/bug17.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test-nsc/files/pos/bug17.scala')
-rwxr-xr-xtest-nsc/files/pos/bug17.scala21
1 files changed, 21 insertions, 0 deletions
diff --git a/test-nsc/files/pos/bug17.scala b/test-nsc/files/pos/bug17.scala
new file mode 100755
index 0000000000..a83eefe972
--- /dev/null
+++ b/test-nsc/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);
+ ()
+ }
+}