summaryrefslogtreecommitdiff
path: root/test/files/pos/t8044.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-03-15 13:24:55 -0700
committerSom Snytt <som.snytt@gmail.com>2016-05-20 16:38:04 -0700
commit1e565d879360709758950332c19a77fffee073d1 (patch)
tree8378eabb74d56ff5148a01141b8269785bd64848 /test/files/pos/t8044.scala
parent2eb1cc2e3df1627cde35afa1237cb10f508fe2f2 (diff)
downloadscala-1e565d879360709758950332c19a77fffee073d1.tar.gz
scala-1e565d879360709758950332c19a77fffee073d1.tar.bz2
scala-1e565d879360709758950332c19a77fffee073d1.zip
SI-8044 Allow any id in explicit pattern binding
Allows arbitrary identifier in `X @ pat`, including non-varids. This goes to regularity. Users of this syntax are not likely to be confused by the "backquoted var id is stable" rule. Also for sequence pattern, `X @ _*`.
Diffstat (limited to 'test/files/pos/t8044.scala')
-rw-r--r--test/files/pos/t8044.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/files/pos/t8044.scala b/test/files/pos/t8044.scala
index 8259f06a8a..2519a8306b 100644
--- a/test/files/pos/t8044.scala
+++ b/test/files/pos/t8044.scala
@@ -4,4 +4,12 @@ trait T {
def g = 42 match { case `type` @ _ => `type` }
def h = 42 match { case `type` : Int => `type` }
def i = (null: Any) match { case _: Int | _: String => 17 }
+
+ // arbitrary idents allowed in @ syntax
+ def j = "Fred" match { case Name @ (_: String) => Name }
+ def k = "Fred" match { case * @ (_: String) => * }
+
+ // also in sequence pattern
+ def m = List(1,2,3,4,5) match { case List(1, `Rest of them` @ _*) => `Rest of them` }
+
}