summaryrefslogblamecommitdiff
path: root/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
blob: 9b1d0eed35f17299e5716cba86ac59351be07179 (plain) (tree)
1
2
3
4
5
6
7
8
                                       
                                            

              
                                                                                  
                               
                       
                                        





                                                                       




                                                        
 
import scala.reflect.runtime.universe._
import scala.reflect.macros.blackbox.Context

object Impls {
  def foo_targs[T, U: c.WeakTypeTag](c: Context = null)(x: c.Expr[Int] = null) = {
    import c.{prefix => prefix}
    import c.universe._
    val U = implicitly[c.WeakTypeTag[U]]
    c.Expr[Unit](q"""
      println("invoking foo_targs...")
      println("type of prefix is: " + ${prefix.staticType.toString})
      println("type of prefix tree is: " + ${prefix.tree.tpe.toString})
      println("U is: " + ${U.tpe.toString})
    """)
  }
}

class Macros[T] {
  def foo_targs[U](x: Int) = macro Impls.foo_targs[T, U]
}