aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLucas Burson <ljdelight@gmail.com>2016-10-16 22:07:59 -0500
committerLucas Burson <ljdelight@gmail.com>2016-10-23 08:58:42 -0500
commitc8595caee80d8f2015ec791bb9cc8d6e7e27802b (patch)
tree78dc75c94f7026cba3ce987221413fc244fb0177 /src
parentcdb83f92f107b87f709f10cdeca3f60e8296acac (diff)
downloaddotty-c8595caee80d8f2015ec791bb9cc8d6e7e27802b.tar.gz
dotty-c8595caee80d8f2015ec791bb9cc8d6e7e27802b.tar.bz2
dotty-c8595caee80d8f2015ec791bb9cc8d6e7e27802b.zip
Update error message at Parsers.scala:1901
This one is about a 'missing return type' when we can't infer a type. I used tests/neg/i871.scala to verify the change.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/parsing/Parsers.scala2
-rw-r--r--src/dotty/tools/dotc/reporting/diagnostic/messages.scala16
2 files changed, 15 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala
index 1987ce348..17e894144 100644
--- a/src/dotty/tools/dotc/parsing/Parsers.scala
+++ b/src/dotty/tools/dotc/parsing/Parsers.scala
@@ -1898,7 +1898,7 @@ object Parsers {
else EmptyTree
}
else {
- if (!isExprIntro) syntaxError("missing return type", in.lastOffset)
+ if (!isExprIntro) syntaxError(MissingReturnType(), in.lastOffset)
accept(EQUALS)
expr()
}
diff --git a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
index 59ed5fb83..c4e84aaee 100644
--- a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
+++ b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
@@ -275,10 +275,10 @@ object messages {
val explanation = ""
}
-
+
case class EarlyDefinitionsNotSupported()(implicit ctx:Context) extends Message(9) {
val kind = "Syntax"
-
+
val msg = "early definitions are not supported; use trait parameters instead"
val code1 =
@@ -500,4 +500,16 @@ object messages {
|which cannot start with ${Red(illegalToken)}.""".stripMargin
}
}
+
+ case class MissingReturnType()(implicit ctx:Context) extends Message(18) {
+ val kind = "Syntax"
+ val msg = "missing return type"
+ val explanation =
+ hl"""An abstract declaration must have a return type. For example:
+ |
+ |trait Shape {
+ | def area: Double // abstract declaration returning a ${"Double"}
+ |}""".stripMargin
+ }
+
}