summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala8
-rw-r--r--test/files/run/t7985.scala3
-rw-r--r--test/files/run/t7985b.scala5
3 files changed, 13 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index ef4052d5f3..0429e295b4 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1774,10 +1774,12 @@ 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) =>
- atPos(start) { Bind(identForType(), EmptyTree) }
case _ =>
- typ()
+ typ() match {
+ case Ident(name: TypeName) if nme.isVariableName(name) =>
+ atPos(start) { Bind(name, EmptyTree) }
+ case t => t
+ }
}
}
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] => }
+}
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] => }
+}