diff options
author | Abel Nieto <abeln@google.com> | 2017-03-16 15:49:06 -0400 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-03-17 18:54:19 +0100 |
commit | d0621108bad55f9fc66c1c5ade9a0b7edb3117e7 (patch) | |
tree | c8374913e8a724e80cd773ef7f3438500beb125e /compiler/test/dotty/tools | |
parent | 2325863c216e2bf4f7ad0f366bb80ef866ff6b79 (diff) | |
download | dotty-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')
-rw-r--r-- | compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala | 24 |
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) + } } |