aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/reporting
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools/dotc/reporting')
-rw-r--r--compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java1
-rw-r--r--compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala17
2 files changed, 18 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java b/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java
index 7b56c8ed4..6ea168b99 100644
--- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java
+++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java
@@ -55,6 +55,7 @@ public enum ErrorMessageID {
RecursiveValueNeedsResultTypeID,
CyclicReferenceInvolvingID,
CyclicReferenceInvolvingImplicitID,
+ SuperQualMustBeParentID,
;
public int errorNumber() {
diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
index 4c53fa496..6fa056646 100644
--- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
+++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
@@ -1192,4 +1192,21 @@ object messages {
|""".stripMargin
}
+ case class SuperQualMustBeParent(qual: untpd.Ident, cls: Symbols.ClassSymbol)(implicit ctx: Context)
+ extends Message(SuperQualMustBeParentID) {
+
+ val msg = hl"""|$qual does not name a parent of $cls"""
+
+ val kind = "Reference"
+
+ private val parents: Seq[String] = (cls.info.parents map (_.name.show)).sorted
+
+ val explanation =
+ hl"""|When a qualifier ${"T"} is used in a ${"super"} prefix of the form ${"C.super[T]"},
+ |${"T"} must be a parent type of ${"C"}.
+ |
+ |In this case, the parents of $cls are:
+ |${parents.mkString(" - ", "\n - ", "")}
+ |""".stripMargin
+ }
}