summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala2
-rw-r--r--test/files/presentation/t8459.check14
-rw-r--r--test/files/presentation/t8459/Test.scala3
-rw-r--r--test/files/presentation/t8459/src/IncompleteDynamicSelect.scala14
4 files changed, 32 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)
diff --git a/test/files/presentation/t8459.check b/test/files/presentation/t8459.check
new file mode 100644
index 0000000000..336c147141
--- /dev/null
+++ b/test/files/presentation/t8459.check
@@ -0,0 +1,14 @@
+reload: IncompleteDynamicSelect.scala
+
+askType at IncompleteDynamicSelect.scala(12,2)
+================================================================================
+[response] askTypeAt (12,2)
+scala.AnyRef {
+ def <init>(): Foo = {
+ Foo.super.<init>();
+ ()
+ };
+ private[this] val bar: F = new F();
+ Foo.this.bar.<selectDynamic: error>("<error>")
+}
+================================================================================
diff --git a/test/files/presentation/t8459/Test.scala b/test/files/presentation/t8459/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/files/presentation/t8459/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/files/presentation/t8459/src/IncompleteDynamicSelect.scala b/test/files/presentation/t8459/src/IncompleteDynamicSelect.scala
new file mode 100644
index 0000000000..61976fe2f9
--- /dev/null
+++ b/test/files/presentation/t8459/src/IncompleteDynamicSelect.scala
@@ -0,0 +1,14 @@
+import scala.language.dynamics
+
+class F extends Dynamic {
+ def applyDynamic(name: String)(args: Any*) =
+ s"method '$name' called with arguments ${args.mkString("'", "', '", "'")}"
+}
+
+class Foo {
+ val bar = new F
+
+ bar. //note whitespace after dot
+ /*?*/ //force typechecking
+}
+