From 77ecff775efd6ec21730ebd478722260b0f6c6b3 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 19 Nov 2013 21:37:27 +0100 Subject: SI-7985 Allow qualified type argument in patterns We were considering the lower case `s` in `case _: Array[scala.Int]` as a sign that we were dealing with a type variable pattern. Now, we only do this if a lookahead confirms the absence of a the `.` --- src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 2 +- test/files/run/t7985.scala | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 test/files/run/t7985.scala diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index ef4052d5f3..4e4a7738cb 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1774,7 +1774,7 @@ self => in.nextToken() if (in.token == SUBTYPE || in.token == SUPERTYPE) wildcardType(start) else atPos(start) { Bind(tpnme.WILDCARD, EmptyTree) } - case IDENTIFIER if nme.isVariableName(in.name) => + case IDENTIFIER if nme.isVariableName(in.name) && lookingAhead(in.token != DOT) => atPos(start) { Bind(identForType(), EmptyTree) } case _ => typ() diff --git a/test/files/run/t7985.scala b/test/files/run/t7985.scala new file mode 100644 index 0000000000..5fe270f9c0 --- /dev/null +++ b/test/files/run/t7985.scala @@ -0,0 +1,3 @@ +object Test extends App { + Array(1) match { case _: Array[scala.Int] => } +} -- cgit v1.2.3