aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/tools/dotc/reporting
diff options
context:
space:
mode:
authorAbel Nieto <abeln@google.com>2017-03-16 15:49:06 -0400
committerFelix Mulder <felix.mulder@gmail.com>2017-03-17 18:54:19 +0100
commitd0621108bad55f9fc66c1c5ade9a0b7edb3117e7 (patch)
treec8374913e8a724e80cd773ef7f3438500beb125e /compiler/test/dotty/tools/dotc/reporting
parent2325863c216e2bf4f7ad0f366bb80ef866ff6b79 (diff)
downloaddotty-d0621108bad55f9fc66c1c5ade9a0b7edb3117e7.tar.gz
dotty-d0621108bad55f9fc66c1c5ade9a0b7edb3117e7.tar.bz2
dotty-d0621108bad55f9fc66c1c5ade9a0b7edb3117e7.zip
Move 'invalid super qualifier' error to new error format.
As part of https://github.com/lampepfl/dotty/issues/1589, use the new error message for static super references where the qualifier isn't a parent of the class. Tested: Added unit test.
Diffstat (limited to 'compiler/test/dotty/tools/dotc/reporting')
-rw-r--r--compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
index f11c6dd96..be160ac7f 100644
--- a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
+++ b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
@@ -304,5 +304,29 @@ class ErrorMessagesTests extends ErrorMessagesTest {
assertEquals("x", tree.name.show)
}
+ @Test def superQualMustBeParent =
+ checkMessagesAfter("frontend") {
+ """
+ |class A {
+ | def foo(): Unit = ()
+ |}
+ |
+ |class B {
+ |}
+ |
+ |class C extends A {
+ | super[B].foo
+ |}
+ """.stripMargin
+ }
+ .expect { (ictx, messages) =>
+ implicit val ctx: Context = ictx
+ val defn = ictx.definitions
+ assertMessageCount(1, messages)
+ val SuperQualMustBeParent(qual, cls) :: Nil = messages
+
+ assertEquals("B", qual.show)
+ assertEquals("class C", cls.show)
+ }
}