diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-10-23 13:22:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-23 13:22:23 +0200 |
commit | cdb83f92f107b87f709f10cdeca3f60e8296acac (patch) | |
tree | 92d693723cb06338fa8dbff03b1165f1f46d4e42 /src | |
parent | 0e3b4aaac845a88abad12e75ca0421a66752dd61 (diff) | |
parent | 65f7ea93f0ffcdc1cef7779b1ff0c95506994ccf (diff) | |
download | dotty-cdb83f92f107b87f709f10cdeca3f60e8296acac.tar.gz dotty-cdb83f92f107b87f709f10cdeca3f60e8296acac.tar.bz2 dotty-cdb83f92f107b87f709f10cdeca3f60e8296acac.zip |
Merge pull request #1613 from jyotman94/error_message_Parsers.scala-1180
Add error message - Parsers.scala:1180
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 | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala index 80c8f7b15..1987ce348 100644 --- a/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/src/dotty/tools/dotc/parsing/Parsers.scala @@ -1177,7 +1177,7 @@ object Parsers { case _ => if (isLiteral) literal() else { - syntaxErrorOrIncomplete("illegal start of simple expression") + syntaxErrorOrIncomplete(IllegalStartSimpleExpr(tokenString(in.token))) errorTermTree } } diff --git a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index ce60d053a..59ed5fb83 100644 --- a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -482,4 +482,22 @@ object messages { |but an uninitialized var definition """.stripMargin } + + case class IllegalStartSimpleExpr(illegalToken: String)(implicit ctx: Context) extends Message(17) { + val kind = "Syntax" + val msg = "illegal start of simple expression" + val explanation = { + hl"""|An expression yields a value. In the case of the simple expression, this error + |commonly occurs when there's a missing parenthesis or brace. The reason being + |that a simple expression is one of the following: + | + |- Block + |- Expression in parenthesis + |- Identifier + |- Object creation + |- Literal + | + |which cannot start with ${Red(illegalToken)}.""".stripMargin + } + } } |