diff options
Diffstat (limited to 'compiler/src/dotty/tools/dotc/reporting')
-rw-r--r-- | compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java | 4 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 26 |
2 files changed, 26 insertions, 4 deletions
diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java b/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java index 02869e752..f6d0de352 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java @@ -52,8 +52,10 @@ public enum ErrorMessageID { MixedLeftAndRightAssociativeOpsID, CantInstantiateAbstractClassOrTraitID, AnnotatedPrimaryConstructorRequiresModifierOrThisID, - OverloadedOrRecursiveMethodNeedsResultTypeID, + OverloadedMethodNeedsResultTypeID, + RecursiveMethodNeedsResultTypeID, RecursiveValueNeedsResultTypeID, + CyclicReferenceInvolvingID, CyclicReferenceInvolvingImplicitID, ; diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 9d899923b..44ae98d82 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -18,6 +18,7 @@ import dotc.parsing.Tokens import printing.Highlighting._ import printing.Formatting import ErrorMessageID._ +import dotty.tools.dotc.core.SymDenotations.SymDenotation object messages { @@ -1161,16 +1162,25 @@ object messages { |""".stripMargin } - case class OverloadedOrRecursiveMethodNeedsResultType(tree: Names.TermName)(implicit ctx: Context) - extends Message(OverloadedOrRecursiveMethodNeedsResultTypeID) { + case class OverloadedMethodNeedsResultType(tree: Names.TermName)(implicit ctx: Context) + extends Message(OverloadedMethodNeedsResultTypeID) { val kind = "Syntax" - val msg = hl"""overloaded or recursive method ${tree} needs result type""" + val msg = hl"""overloaded method ${tree} needs result type""" val explanation = hl"""|${tree} is overloaded and at least one definition of it calls another. |You need to specify the calling method's return type. """.stripMargin } + case class RecursiveMethodNeedsResultType(tree: Names.TermName)(implicit ctx: Context) + extends Message(RecursiveMethodNeedsResultTypeID) { + val kind = "Syntax" + val msg = hl"""recursive method ${tree} needs result type""" + val explanation = + hl"""|The definition of `${tree.name}` is recursive and you need to specify its type. + """.stripMargin + } + case class RecursiveValueNeedsResultType(tree: Names.TermName)(implicit ctx: Context) extends Message(RecursiveValueNeedsResultTypeID) { val kind = "Syntax" @@ -1180,6 +1190,16 @@ object messages { """.stripMargin } + case class CyclicReferenceInvolving(denot: SymDenotation)(implicit ctx: Context) + extends Message(CyclicReferenceInvolvingID) { + val kind = "Syntax" + val msg = hl"""cyclic reference involving $denot""" + val explanation = + hl"""|$denot is declared as part of a cycle which makes it impossible for the + |compiler to decide upon ${denot.name}'s type. + |""".stripMargin + } + case class CyclicReferenceInvolvingImplicit(cycleSym: Symbol)(implicit ctx: Context) extends Message(CyclicReferenceInvolvingImplicitID) { val kind = "Syntax" |