summaryrefslogtreecommitdiff
path: root/test/files/pos/t8044.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-01-30 21:53:27 -0800
committerSom Snytt <som.snytt@gmail.com>2016-05-20 16:12:03 -0700
commiteeef2602dc97f84c798713d7a2c924ea2b0d6012 (patch)
tree06a2e64b97d73f303583f82af8bdfafc75aff477 /test/files/pos/t8044.scala
parent15189d14953335f7a3a8310861d045d21ab22d48 (diff)
downloadscala-eeef2602dc97f84c798713d7a2c924ea2b0d6012.tar.gz
scala-eeef2602dc97f84c798713d7a2c924ea2b0d6012.tar.bz2
scala-eeef2602dc97f84c798713d7a2c924ea2b0d6012.zip
SI-8044 Allow binding backquoted varid in patterns
Previously, a varid could not be backquoted, so that it was not possible to introduce variables with names such as `type` in a match expression. This commit allows backquoted varids in `case x @ _` and `case x: Int`. In neither position is a stable id accepted, that is, an id with leading uppercase. Therefore, this commit merely relaxes the backquoted varid to be taken as a normal varid in these contexts.
Diffstat (limited to 'test/files/pos/t8044.scala')
-rw-r--r--test/files/pos/t8044.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/files/pos/t8044.scala b/test/files/pos/t8044.scala
new file mode 100644
index 0000000000..8259f06a8a
--- /dev/null
+++ b/test/files/pos/t8044.scala
@@ -0,0 +1,7 @@
+
+trait T {
+ def f = 42 match { case `x` @ _ => x }
+ def g = 42 match { case `type` @ _ => `type` }
+ def h = 42 match { case `type` : Int => `type` }
+ def i = (null: Any) match { case _: Int | _: String => 17 }
+}