blob: 70e79cc2b40ca04878c2caf3cfe3cee7743c2613 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import language.experimental.macros
import scala.reflect.macros.Context
class C1(val n: Int) extends AnyVal
class C2(val n: Int) extends AnyRef
object Macros {
type F1 = C1
type F2 = C2
def foo = macro impl
def impl(c: Context) = {
import c.universe._
def test[T: c.TypeTag] = reify(println(c.literal(c.reifyRuntimeClass(c.typeOf[T]).toString).splice)).tree
def tests = Block(List(test[C1], test[C2], test[F1], test[F2]), Literal(Constant(())))
c.Expr[Unit](tests)
}
}
|