From 187c241d7b2b3698a5773463c17fd26c8294d0f7 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 2 Feb 2016 12:34:14 +0100 Subject: New test files from SI 7278. --- tests/run/t7278.scala | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/run/t7278.scala (limited to 'tests/run/t7278.scala') diff --git a/tests/run/t7278.scala b/tests/run/t7278.scala new file mode 100644 index 000000000..d408ed550 --- /dev/null +++ b/tests/run/t7278.scala @@ -0,0 +1,32 @@ +class Foo { + class Bar { + def foo = 1 + } + } + + class SubFoo extends Foo { + class SubBar { + def foo = 42 + } + } + +object Test { + def main(args: Array[String]): Unit = { + +// Let's create some instances: + val foo = new Foo + val fooBar = new foo.Bar + assert(fooBar.foo == 1) //> res0: Int = 1 + // ok + + val subFoo = new SubFoo + val subFooBar = new subFoo.SubBar + assert(subFooBar.foo == 42) //> res1: Int = 42 + // ok + + val superFoo: Foo = subFoo + val superFooBar = new superFoo.Bar + assert(superFooBar.foo == 1) //> res2: Int = 1 + // NOT OK! + } +} -- cgit v1.2.3