aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-11 09:22:56 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 14:11:58 +0200
commit0eb06db64b66a63d722ba580d5e94506febd9dc8 (patch)
treec8f39d564cdfd67c75eb508e93a54c99676084b1 /tests
parente4a6d72a52b4b9c3ce5530197352ca11e11fc9aa (diff)
downloaddotty-0eb06db64b66a63d722ba580d5e94506febd9dc8.tar.gz
dotty-0eb06db64b66a63d722ba580d5e94506febd9dc8.tar.bz2
dotty-0eb06db64b66a63d722ba580d5e94506febd9dc8.zip
Handle supercalls in inner classes correctly
The previous fix was too coarse. We need to move an anonymous function in a supercall towards the call, we just have to make sure it's not in the directly enclosing class.
Diffstat (limited to 'tests')
-rw-r--r--tests/run/i2163.scala16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/run/i2163.scala b/tests/run/i2163.scala
index a187cd4c8..952f651e3 100644
--- a/tests/run/i2163.scala
+++ b/tests/run/i2163.scala
@@ -1,9 +1,21 @@
class Base(f: Int => Int) {
- println(f(3))
+ def result = f(3)
}
class Child(x: Int) extends Base(y => x + y)
+class Outer(z: Int) {
+ class Base(f: Int => Int) {
+ def result = f(3)
+ }
+
+ class Child(x: Int) extends Base(y => x + y + z)
+}
+
object Test {
- def main(args: Array[String]): Unit = new Child(4)
+ def main(args: Array[String]): Unit = {
+ assert(new Child(4).result == 7)
+ val o = new Outer(2)
+ assert(new o.Child(2).result == 7)
+ }
}