diff options
author | Paul Phillips <paulp@improving.org> | 2011-02-07 04:45:22 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-02-07 04:45:22 +0000 |
commit | fcc962b1973aedf1c892aac0d1fce7e5fa32fbc0 (patch) | |
tree | 8a8fb1e4366083b7c490b4b1f43a9bd3858d6191 /src | |
parent | 7b19ec8b1b296913adb5c226decd16f1e091c76b (diff) | |
download | scala-fcc962b1973aedf1c892aac0d1fce7e5fa32fbc0.tar.gz scala-fcc962b1973aedf1c892aac0d1fce7e5fa32fbc0.tar.bz2 scala-fcc962b1973aedf1c892aac0d1fce7e5fa32fbc0.zip |
Fix for parser regression allowing 0-case match...
Fix for parser regression allowing 0-case match blocks. Closes #4217, no
review.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 21628f9864..d75d28c45f 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1542,8 +1542,12 @@ self => /** CaseClauses ::= CaseClause {CaseClause} * CaseClause ::= case Pattern [Guard] `=>' Block */ - def caseClauses(): List[CaseDef] = caseSeparated { - atPos(in.offset)(makeCaseDef(pattern(), guard(), caseBlock())) + def caseClauses(): List[CaseDef] = { + val cases = caseSeparated { atPos(in.offset)(makeCaseDef(pattern(), guard(), caseBlock())) } + if (cases.isEmpty) // trigger error if there are no cases + accept(CASE) + + cases } // IDE HOOK (so we can memoize case blocks) // needed? |