diff options
author | Martin Odersky <odersky@gmail.com> | 2017-02-02 14:55:06 +1100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-02-08 22:20:26 +1100 |
commit | ba66bd47f08e1adf3d44f578452a5113948cb988 (patch) | |
tree | c1f4d9134ffd94f7d750ddbea1798a09bd89fda2 /tests/neg | |
parent | b77c24cde0caa59472108a068b4d802606ad5d1b (diff) | |
download | dotty-ba66bd47f08e1adf3d44f578452a5113948cb988.tar.gz dotty-ba66bd47f08e1adf3d44f578452a5113948cb988.tar.bz2 dotty-ba66bd47f08e1adf3d44f578452a5113948cb988.zip |
Fix #1501 - Check trait inheritance condition
We need to check a coherence condition between the superclass
of a trait and the superclass of an inheriting class or trait.
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/i1501.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/neg/i1501.scala b/tests/neg/i1501.scala new file mode 100644 index 000000000..045f2be1d --- /dev/null +++ b/tests/neg/i1501.scala @@ -0,0 +1,18 @@ +class A { + def foo: Int = 1 +} + +trait B extends A + +abstract class D { + def foo: Int +} + +class C extends D with B // error: illegal trait inheritance +trait E extends D with B // error: illegal trait inheritance + +object Test { + def main(args: Array[String]): Unit = { + println(new C().foo) + } +} |