summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-02-07 04:45:22 +0000
committerPaul Phillips <paulp@improving.org>2011-02-07 04:45:22 +0000
commitfcc962b1973aedf1c892aac0d1fce7e5fa32fbc0 (patch)
tree8a8fb1e4366083b7c490b4b1f43a9bd3858d6191 /src
parent7b19ec8b1b296913adb5c226decd16f1e091c76b (diff)
downloadscala-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.scala8
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?