From 83152c9af10120d6753184c5e111bf458d263dbb Mon Sep 17 00:00:00 2001 From: plocinic Date: Mon, 14 Mar 2011 20:25:11 +0000 Subject: [PATCH] Closes #4163. no review git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@24458 5e8d7ff9-d8ef-0310-90f0-a4852d11357a --- src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 7 +++++-- test/files/neg/t4163.check | 7 +++++++ test/files/neg/t4163.scala | 8 ++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 test/files/neg/t4163.check create mode 100644 test/files/neg/t4163.scala diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 4404a226c..683672dfc 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 @@ -1429,7 +1432,7 @@ self => val t = if (isLiteral) atPos(in.offset)(literal(false)) else in.token match { - case XMLSTART => + case XMLSTART => xmlLiteral() case IDENTIFIER | BACKQUOTED_IDENT | THIS | SUPER => path(true, false) diff --git a/test/files/neg/t4163.check b/test/files/neg/t4163.check new file mode 100644 index 000000000..d27511783 --- /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 000000000..25ce5522a --- /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 +}