diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-10-24 22:38:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 22:38:34 +0200 |
commit | 56731e4b18728427f0b7188eb91afc475b36bb18 (patch) | |
tree | 78dc75c94f7026cba3ce987221413fc244fb0177 /src | |
parent | cdb83f92f107b87f709f10cdeca3f60e8296acac (diff) | |
parent | c8595caee80d8f2015ec791bb9cc8d6e7e27802b (diff) | |
download | dotty-56731e4b18728427f0b7188eb91afc475b36bb18.tar.gz dotty-56731e4b18728427f0b7188eb91afc475b36bb18.tar.bz2 dotty-56731e4b18728427f0b7188eb91afc475b36bb18.zip |
Merge pull request #1616 from ljdelight/errorMessageUpdates
Update error message at Parsers.scala:1901
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/parsing/Parsers.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 16 |
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 + } + } |