diff options
author | Som Snytt <som.snytt@gmail.com> | 2012-04-05 02:58:40 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-04-06 11:57:41 -0700 |
commit | 72f6f0e57ca490b36cef62a3be2a8b3261476cd2 (patch) | |
tree | e140ee692080bed185ba99122b5890b736c1e573 /test/files/neg/t4134.scala | |
parent | 581a2e1a9653b06b6d2c431070e6b1d21383285d (diff) | |
download | scala-72f6f0e57ca490b36cef62a3be2a8b3261476cd2.tar.gz scala-72f6f0e57ca490b36cef62a3be2a8b3261476cd2.tar.bz2 scala-72f6f0e57ca490b36cef62a3be2a8b3261476cd2.zip |
SI-4134: abstract override crasher if lacking super impl
The example from the ticket is committed as a neg test.
The problem is that a super.m on an abstract override
member m has no concrete implementation, that is, the
trait T is not mixed in after a class C with a concrete m.
The error is noticed at phase mixin when the super accessor
is added to the concrete mixer. (Pun alert?) When super.m
is rebound, no concrete matching symbol is found up the
linearization.
Previously, it was asserted that such a symbol should
be found, but since this is our first opportunity to
detect that there is none, an error should be emitted
instead. The new message is of the form:
Member method f of mixin trait T2 is missing a concrete super implementation.
Additionally, a couple of flag tests were changed to use isAbstractOverride.
Diffstat (limited to 'test/files/neg/t4134.scala')
-rw-r--r-- | test/files/neg/t4134.scala | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/files/neg/t4134.scala b/test/files/neg/t4134.scala new file mode 100644 index 0000000000..678e4806ef --- /dev/null +++ b/test/files/neg/t4134.scala @@ -0,0 +1,30 @@ + + + +trait T1 { + def f: String +} + +trait T2 extends T1 { + abstract override def f: String = "goo" + def something = super.f // So the "abstract override" is needed +} + +trait Q1 { + def f: String = "bippy" +} + +//trait T3 extends Q1 with T2 { +trait T3 extends T2 with Q1 { + abstract override def f: String = super[Q1].f + " " + super[T2].f + " hoo" +} + +class Konkret extends T3 + +object Test { + def main(args: Array[String]): Unit = { + val k = new Konkret + println(k.f) + println(k.something) + } +} |