summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorghik <romeqjanoosh@gmail.com>2014-09-17 20:45:01 +0200
committerghik <romeqjanoosh@gmail.com>2014-09-17 20:45:01 +0200
commit7c81959d724a6565c00b86591d54c195d8bed1de (patch)
tree42ad6d8ddfcb0a06111bbb6feb2438a5e5791e3b /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parent190c6726158f3f7e1ac5d26782437c184cee5872 (diff)
downloadscala-7c81959d724a6565c00b86591d54c195d8bed1de.tar.gz
scala-7c81959d724a6565c00b86591d54c195d8bed1de.tar.bz2
scala-7c81959d724a6565c00b86591d54c195d8bed1de.zip
SI-8459 fix incorrect positions for incomplete selection trees
The mentioned issue is a presentation compiler issue, but its root cause is a bug in the parser which incorrectly assigned positions to incomplete selection trees (i.e. selections that lack an indentifier after dot and have some whitespace instead). In detail: for such incomplete selection trees, the "point" of the position should be immediately after the dot but instead was at the start of next token after the dot. For range positions, this caused a pathological situation where the "point" was greater than the "end" of the position. This position is later used by the typechecker during resolution of dynamic calls and causes it to crash. Of course, because a syntactically incorrect code is required for the bug to manifest, it only happens in the presentation compiler.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 8d810d456e..15d6a4d1b4 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1059,7 +1059,7 @@ self =>
def identOrMacro(): Name = if (isMacro) rawIdent() else ident()
def selector(t: Tree): Tree = {
- val point = in.offset
+ val point = if(isIdent) in.offset else in.lastOffset //SI-8459
//assert(t.pos.isDefined, t)
if (t != EmptyTree)
Select(t, ident(skipIt = false)) setPos r2p(t.pos.start, point, in.lastOffset)