File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
main/scala/com/danieltrinh/scalariform/parser
test/scala/com/danieltrinh/scalariform/parser Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -949,7 +949,7 @@ class ScalaParser(tokens: Array[Token]) {
949949 val uscore = nextToken()
950950 val wildcardTypeOpt = if (SUBTYPE || SUPERTYPE ) Some (wildcardType()) else None
951951 typeElementFlatten3(uscore, wildcardTypeOpt)
952- case _ if isIdent && isVariableName(currentToken.text) ⇒
952+ case _ if isIdent && isVariableName(currentToken.text) && ! ( Set ( DOT , HASH ) contains lookahead( 1 )) ⇒
953953 typeElementFlatten3(ident())
954954 case _ ⇒
955955 List (typ())
Original file line number Diff line number Diff line change @@ -41,6 +41,16 @@ class ParserTest extends FlatSpec with ShouldMatchers {
4141 evaluating { parseCompilationUnit(" package a {} package b {}" ) } should produce[ScalaParserException ]
4242 }
4343
44+ // issue #44
45+ " Parser" should " allow qualified type parameter in pattern matching" in {
46+ parseExpression("""
47+ {
48+ case List[scala.Int]() => 1
49+ case _: List[scala.Int] => 2
50+ }
51+ """ )
52+ }
53+
4454 private def parser (s : String ) = new ScalaParser (ScalaLexer .tokenise(s).toArray)
4555 private def parseExpression (s : String ) = parser(s).expr
4656 private def parseCompilationUnit (s : String ) = parser(s).compilationUnit
You can’t perform that action at this time.
0 commit comments