summaryrefslogtreecommitdiff
path: root/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala
blob: eb067c25a5883de5e634db91c0462824204dd738 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import scala.reflect.macros.blackbox.Context

object Impls {
  def foo(c: Context)(xs: c.Expr[Int]*) = {
    import c.universe._
    val stripped_xs = xs map (_.tree) toList match {
      case List(Typed(stripped, Ident(wildstar))) if wildstar == typeNames.WILDCARD_STAR => List(stripped)
      case _ => ???
    }
    val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), stripped_xs)
    c.Expr[Unit](body)
  }
}