summaryrefslogblamecommitdiff
path: root/test/files/run/macro-expand-nullary-generic/Impls_1.scala
blob: 1180c83a40d406481427245cdcd61938627a7ce7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                       
                                            

              
                                        
                       
                                                                                                                                                          
                      

   



                                                                       
 
import scala.reflect.runtime.universe._
import scala.reflect.macros.{Context => Ctx}

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

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