summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala5
-rw-r--r--test/files/neg/t4163.check7
-rw-r--r--test/files/neg/t4163.scala8
3 files changed, 19 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 cc515d957a..38392e5dd6 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -977,7 +977,10 @@ self =>
def selector(t: Tree): Tree = {
val point = in.offset
//assert(t.pos.isDefined, t)
- Select(t, ident(false)) setPos r2p(t.pos.startOrPoint, point, in.lastOffset)
+ if (t != EmptyTree)
+ Select(t, ident(false)) setPos r2p(t.pos.startOrPoint, point, in.lastOffset)
+ else
+ errorTermTree // has already been reported
}
/** Path ::= StableId
diff --git a/test/files/neg/t4163.check b/test/files/neg/t4163.check
new file mode 100644
index 0000000000..d275117833
--- /dev/null
+++ b/test/files/neg/t4163.check
@@ -0,0 +1,7 @@
+t4163.scala:4: error: '<-' expected but '=' found.
+ x = 3
+ ^
+t4163.scala:5: error: illegal start of simple expression
+ y <- 0 to 100
+^
+two errors found
diff --git a/test/files/neg/t4163.scala b/test/files/neg/t4163.scala
new file mode 100644
index 0000000000..25ce5522a4
--- /dev/null
+++ b/test/files/neg/t4163.scala
@@ -0,0 +1,8 @@
+class Bug {
+ val z = (
+ for {
+ x = 3
+ y <- 0 to 100
+ } yield y
+ ).toArray
+}