diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 4 | ||||
-rw-r--r-- | test/files/neg/bug3189.check | 7 | ||||
-rw-r--r-- | test/files/neg/bug3189.scala | 3 |
3 files changed, 13 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 868a8c0dd4..8e9af3c341 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1486,7 +1486,9 @@ self => def pattern3(seqOK: Boolean): Tree = { val base = opstack var top = simplePattern(seqOK) - if (seqOK && isIdent && in.name == STAR) + // See ticket #3189 for the motivation for the null check. + // TODO: dredge out the remnants of regexp patterns. + if (seqOK && isIdent && in.name == STAR && in.prev.name != null) return atPos(top.pos.startOrPoint, in.skipToken())(Star(stripParens(top))) while (isIdent && in.name != BAR) { diff --git a/test/files/neg/bug3189.check b/test/files/neg/bug3189.check new file mode 100644 index 0000000000..520644fd43 --- /dev/null +++ b/test/files/neg/bug3189.check @@ -0,0 +1,7 @@ +bug3189.scala:2: error: illegal start of simple pattern + val Array(a,b*) = ("": Any) + ^ +bug3189.scala:3: error: ')' expected but '}' found. +} +^ +two errors found diff --git a/test/files/neg/bug3189.scala b/test/files/neg/bug3189.scala new file mode 100644 index 0000000000..4ea4bb7581 --- /dev/null +++ b/test/files/neg/bug3189.scala @@ -0,0 +1,3 @@ +object A { + val Array(a,b*) = ("": Any) +}
\ No newline at end of file |