summaryrefslogtreecommitdiff
path: root/test/files/run/macro-expand-nullary-generic/Impls_1.scala
blob: 9a0e97c8e0d5c5804f6e47e3daa940a071d259b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}

object Impls {
  def impl[T: c.TypeTag](c: Ctx) = {
    import c.universe._
    val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.TypeTag[T]]))))
    c.Expr[Unit](body)
  }

  def fooNullary[T: c.TypeTag](c: Ctx) = impl[T](c)
  def fooEmpty[T: c.TypeTag](c: Ctx)() = impl[T](c)
  def barNullary[T: c.TypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c)
  def barEmpty[T: c.TypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c)
}