diff options
author | odersky <odersky@gmail.com> | 2016-03-22 14:08:43 +0100 |
---|---|---|
committer | odersky <odersky@gmail.com> | 2016-03-22 14:08:43 +0100 |
commit | 552a56ae8573f1c08175b3211afa7e414bee681b (patch) | |
tree | 8313a79ea1244780aea013836bef029e23973296 /src | |
parent | fadcf44be1a8db931f86a28bcdd54e49bd8741da (diff) | |
parent | 7e7058a22fcf8806e718bbba94080935a44ece0c (diff) | |
download | dotty-552a56ae8573f1c08175b3211afa7e414bee681b.tar.gz dotty-552a56ae8573f1c08175b3211afa7e414bee681b.tar.bz2 dotty-552a56ae8573f1c08175b3211afa7e414bee681b.zip |
Merge pull request #1184 from liufengyun/error-pos
better positioning of `_*` not last argument error
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/parsing/JavaParsers.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/parsing/Parsers.scala | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/parsing/JavaParsers.scala b/src/dotty/tools/dotc/parsing/JavaParsers.scala index b4d01a0da..fbb362354 100644 --- a/src/dotty/tools/dotc/parsing/JavaParsers.scala +++ b/src/dotty/tools/dotc/parsing/JavaParsers.scala @@ -175,6 +175,8 @@ object JavaParsers { /** Consume one token of the specified type, or * signal an error if it is not there. + * + * @return The offset at the start of the token to accept */ def accept(token: Int): Int = { val offset = in.offset diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala index ea9da8db9..44a70886e 100644 --- a/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/src/dotty/tools/dotc/parsing/Parsers.scala @@ -227,6 +227,8 @@ object Parsers { /** Consume one token of the specified type, or * signal an error if it is not there. + * + * @return The offset at the start of the token to accept */ def accept(token: Int): Int = { val offset = in.offset @@ -234,7 +236,7 @@ object Parsers { syntaxErrorOrIncomplete(expectedMsg(token)) } if (in.token == token) in.nextToken() - in.offset + offset } /** semi = nl {nl} | `;' @@ -1019,7 +1021,7 @@ object Parsers { val uscoreStart = in.skipToken() if (isIdent(nme.raw.STAR)) { in.nextToken() - if (in.token != RPAREN) syntaxError("`_*' can be used only for last argument") + if (in.token != RPAREN) syntaxError("`_*' can be used only for last argument", uscoreStart) Typed(t, atPos(uscoreStart) { Ident(tpnme.WILDCARD_STAR) }) } else { syntaxErrorOrIncomplete("`*' expected"); t |