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/messages.scala44
1 files changed, 23 insertions, 21 deletions
diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
index f2f69b6cc..9d899923b 100644
--- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
+++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
@@ -1146,46 +1146,48 @@ object messages {
|""".stripMargin
}
+ case class AnnotatedPrimaryConstructorRequiresModifierOrThis(cls: Name)(implicit ctx: Context)
+ extends Message(AnnotatedPrimaryConstructorRequiresModifierOrThisID) {
+ val kind = "Syntax"
+ val msg = hl"""${"private"}, ${"protected"}, or ${"this"} expected for annotated primary constructor"""
+ val explanation =
+ hl"""|When using annotations with a primary constructor of a class,
+ |the annotation must be followed by an access modifier
+ |(${"private"} or ${"protected"}) or ${"this"}.
+ |
+ |For example:
+ | ${"class Sample @deprecated this(param: Parameter) { ..."}
+ | ^^^^
+ |""".stripMargin
+ }
+
case class OverloadedOrRecursiveMethodNeedsResultType(tree: Names.TermName)(implicit ctx: Context)
extends Message(OverloadedOrRecursiveMethodNeedsResultTypeID) {
val kind = "Syntax"
val msg = hl"""overloaded or recursive method ${tree} needs result type"""
val explanation =
- hl"""
- |
- """.stripMargin
+ 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 RecursiveValueNeedsResultType(tree: Names.TermName)(implicit ctx: Context)
- extends Message(RecursiveValueNeedsResultTypeID) {
+ extends Message(RecursiveValueNeedsResultTypeID) {
val kind = "Syntax"
val msg = hl"""recursive value ${tree.name} needs type"""
val explanation =
- hl"""""".stripMargin
+ hl"""|The definition of `${tree.name}` is recursive and you need to specify its type.
+ """.stripMargin
}
case class CyclicReferenceInvolvingImplicit(cycleSym: Symbol)(implicit ctx: Context)
- extends Message(CyclicReferenceInvolvingImplicitID) {
+ extends Message(CyclicReferenceInvolvingImplicitID) {
val kind = "Syntax"
val msg = hl"""cyclic reference involving implicit $cycleSym"""
val explanation =
hl"""|This happens when the right hand-side of $cycleSym's definition involves an implicit search.
- |To avoid the error, give $cycleSym an explicit type.
+ |To avoid this error, give `${cycleSym.name}` an explicit type.
|""".stripMargin
}
- case class AnnotatedPrimaryConstructorRequiresModifierOrThis(cls: Name)(implicit ctx: Context)
- extends Message(AnnotatedPrimaryConstructorRequiresModifierOrThisID) {
- val kind = "Syntax"
- val msg = hl"""${"private"}, ${"protected"}, or ${"this"} expected for annotated primary constructor"""
- val explanation =
- hl"""|When using annotations with a primary constructor of a class,
- |the annotation must be followed by an access modifier
- |(${"private"} or ${"protected"}) or ${"this"}.
- |
- |For example:
- | ${"class Sample @deprecated this(param: Parameter) { ..."}
- | ^^^^
- |""".stripMargin
- }
}