From b1d305388d21e3fd86660579f507889fd7b73e6f Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 19 Nov 2013 21:44:06 +0100 Subject: SI-7985 Allow projection of lower-cased prefix as pattern type arg As per the last commit, tighten up the interpretation of a lower cased identifier meaning that we're looking at a type variable. --- src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 2 +- test/files/run/t7985b.scala | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 test/files/run/t7985b.scala diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 4e4a7738cb..7fb21c86d9 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) && lookingAhead(in.token != DOT) => + case IDENTIFIER if nme.isVariableName(in.name) && lookingAhead(in.token != DOT && in.token != HASH) => atPos(start) { Bind(identForType(), EmptyTree) } case _ => typ() diff --git a/test/files/run/t7985b.scala b/test/files/run/t7985b.scala new file mode 100644 index 0000000000..aaf649eb28 --- /dev/null +++ b/test/files/run/t7985b.scala @@ -0,0 +1,5 @@ +class a { type X = Int } + +object Test extends App { + Array(1) match { case _: Array[a#X] => } +} -- cgit v1.2.3