diff options
author | schinz <schinz@epfl.ch> | 2003-08-29 13:33:09 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2003-08-29 13:33:09 +0000 |
commit | cc58ab3a7f52b83e6d27cdd040a1c43d61300fb3 (patch) | |
tree | 43359f98800f6611d6b5ece071563f35bfd408dd /test/files/run/mixins.scala | |
parent | 9cf507cee318dd67302a18a94d70886e63ebe972 (diff) | |
download | scala-cc58ab3a7f52b83e6d27cdd040a1c43d61300fb3.tar.gz scala-cc58ab3a7f52b83e6d27cdd040a1c43d61300fb3.tar.bz2 scala-cc58ab3a7f52b83e6d27cdd040a1c43d61300fb3.zip |
*** empty log message ***
Diffstat (limited to 'test/files/run/mixins.scala')
-rw-r--r-- | test/files/run/mixins.scala | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/test/files/run/mixins.scala b/test/files/run/mixins.scala new file mode 100644 index 0000000000..0b1a43d6b4 --- /dev/null +++ b/test/files/run/mixins.scala @@ -0,0 +1,59 @@ +// $Id$ + +// Test 1: "super" coming from mixins + +object Test1 { + class A { + def f = "A::f"; + } + + class B extends A { + override def f = "B::f"; + } + + class M1 extends A { + override def f = "M1::" + super.f; + } + + class C extends B with M1 { + } + + def main(args: Array[String]): Unit = { + val c = new C; + System.out.println(c.f); + } +} + +// Test 2: qualified "super" inside of the host class + +object Test2 { + class M1 { + def f = "M1::f"; + } + + class M2 { + def f = "M2::f"; + } + + class M3 { + def f = "M3::f"; + } + + class Host with M1 with M2 with M3 { + override def f = super[M1].f + " " + super[M2].f + " " + super[M3].f + } + + def main(args: Array[String]): Unit = { + val h = new Host; + System.out.println(h.f) + } +} + +// Main testing function + +object Test { + def main(args: Array[String]): Unit = { + Test1.main(args); + Test2.main(args); + } +} |