diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-09-04 00:08:42 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-09-04 00:08:42 -0700 |
commit | 350ec9547908f0692431370cb1510dcb769576ff (patch) | |
tree | 75b3e06d58ea27defccbdc5cab576ef5974891e8 | |
parent | 4b9fdd340c47cb258223e1a68b560e2ddcffcb5d (diff) | |
parent | 27d61a2ef6c3059fd56a36fc18886fc53bb354a8 (diff) | |
download | scala-350ec9547908f0692431370cb1510dcb769576ff.tar.gz scala-350ec9547908f0692431370cb1510dcb769576ff.tar.bz2 scala-350ec9547908f0692431370cb1510dcb769576ff.zip |
Merge pull request #2899 from som-snytt/issue/4760-parser
SI-4760 Parser handles block-ending import
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t4760.scala | 34 |
2 files changed, 35 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 50398824e1..5476afa75e 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -3067,7 +3067,7 @@ self => while (!isStatSeqEnd && in.token != CASE) { if (in.token == IMPORT) { stats ++= importClause() - acceptStatSep() + acceptStatSepOpt() } else if (isExprIntro) { stats += statement(InBlock) diff --git a/test/files/pos/t4760.scala b/test/files/pos/t4760.scala new file mode 100644 index 0000000000..767e3847f4 --- /dev/null +++ b/test/files/pos/t4760.scala @@ -0,0 +1,34 @@ + +class Test { + // parses + def f1 = { + import scala._; + } + // b.scala:7: error: ';' expected but '}' found. + // } + // ^ + // one error found + def f2 = { + import scala._ + } + def f2b = { + import scala.collection.mutable.{ Map => MMap } + } + def f(): Unit = { + locally { + import scala.util.Properties.lineSeparator + } + } + + // parses + def f3 = { + import scala._ + 5 + } + locally { (x: Int) => + import scala.util._ + } + 1 match { + case 1 => import scala.concurrent._ + } +} |