Skip to content

Commit

Permalink
SIP-27 Test varargs, "@", and ": _*"
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Jan 8, 2017
1 parent 7966edd commit c95e6bb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/files/pos/trailing-commas.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c95e6bb

Please sign in to comment.