aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/reporting
diff options
context:
space:
mode:
authorEnno Runne <enno@runne.net>2017-02-23 13:51:42 +0100
committerEnno Runne <enno@runne.net>2017-02-23 13:51:42 +0100
commit9202810e80997105a598a3298f1ac199d5324a23 (patch)
tree72753eadf72abedaa71394c4c23cc8b22936dd5c /compiler/src/dotty/tools/dotc/reporting
parent2699715684e9ea474001e9fc85bb3c7d25ed1ca5 (diff)
downloaddotty-9202810e80997105a598a3298f1ac199d5324a23.tar.gz
dotty-9202810e80997105a598a3298f1ac199d5324a23.tar.bz2
dotty-9202810e80997105a598a3298f1ac199d5324a23.zip
Change 'private, protected, or this expected' to Message
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.scala14
2 files changed, 15 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 2bf15cb7c..bbd93eb30 100644
--- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java
+++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java
@@ -51,6 +51,7 @@ public enum ErrorMessageID {
ExpectedTokenButFoundID,
MixedLeftAndRightAssociativeOpsID,
CantInstantiateAbstractClassOrTraitID,
+ AnnotatedPrimaryConstructorRequiresModifierOrThisID,
;
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 34190c114..e367e9ab2 100644
--- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
+++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
@@ -1146,4 +1146,18 @@ 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
+ }
}