aboutsummaryrefslogtreecommitdiff
path: root/tests/run/t7278.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-02-02 12:34:14 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-09 09:43:08 +0100
commit187c241d7b2b3698a5773463c17fd26c8294d0f7 (patch)
tree7a3d752dec79c4d75ce1f766e563f226be08e398 /tests/run/t7278.scala
parenteaa157860fd278f7d1404bb2aa495547277fd311 (diff)
downloaddotty-187c241d7b2b3698a5773463c17fd26c8294d0f7.tar.gz
dotty-187c241d7b2b3698a5773463c17fd26c8294d0f7.tar.bz2
dotty-187c241d7b2b3698a5773463c17fd26c8294d0f7.zip
New test files from SI 7278.
Diffstat (limited to 'tests/run/t7278.scala')
-rw-r--r--tests/run/t7278.scala32
1 files changed, 32 insertions, 0 deletions
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!
+ }
+}