diff options
author | Dale Wijnand <dale.wijnand@gmail.com> | 2017-01-08 16:52:51 +0000 |
---|---|---|
committer | Dale Wijnand <dale.wijnand@gmail.com> | 2017-01-08 17:50:51 +0000 |
commit | c95e6bb6ae3693be016a89b7aa4dc19a24fe363d (patch) | |
tree | 9d83ef0921bac7dabd9cd27983e7a9b034c592b7 /test/files/pos/trailing-commas.scala | |
parent | 7966edd724b1e1019d3f8466318bc5f4b341abab (diff) | |
download | scala-c95e6bb6ae3693be016a89b7aa4dc19a24fe363d.tar.gz scala-c95e6bb6ae3693be016a89b7aa4dc19a24fe363d.tar.bz2 scala-c95e6bb6ae3693be016a89b7aa4dc19a24fe363d.zip |
SIP-27 Test varargs, "@", and ": _*"
From https://gist.github.com/lrytz/e10b166ffbed2e47348a7ef8cd072fd9
Diffstat (limited to 'test/files/pos/trailing-commas.scala')
-rw-r--r-- | test/files/pos/trailing-commas.scala | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/files/pos/trailing-commas.scala b/test/files/pos/trailing-commas.scala index 125dda35fb..52273b4dbd 100644 --- a/test/files/pos/trailing-commas.scala +++ b/test/files/pos/trailing-commas.scala @@ -9,6 +9,13 @@ trait ArgumentExprs1 { Ev0, Ev1, ) + + // test arg exprs in the presence of varargs + def g(x: Int, y: Int*) = 1 + g(1,2, + ) + g(1,List(2, 3): _*, + ) } trait ArgumentExprs2 { @@ -40,6 +47,10 @@ trait ClassParams { ev0: Ev0, ev1: Ev1, ) + + // test class params in the precense of varargs + case class D(i: Int*, + ) } trait SimpleExpr1 { @@ -100,6 +111,18 @@ trait SimplePattern { foo, bar, ) = null: Any + + // test '@' syntax in patterns + Some(1) match { + case Some(x @ 1, + ) => x + } + + // test ': _*' syntax in patterns + List(1, 2, 3) match { + case List(1, 2, _ @ _*, + ) => 1 + } } trait ImportSelectors { |