blob: be00fd0d8a1d8f9637384920736255e69e2b2b72 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
|
import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo[U](c: Ctx)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = {
import c.universe._
val plusOne = Apply(Select(evidence.tree, newTermName("plus")), List(x.tree, Literal(Constant(1))))
val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(plusOne))
Expr[Unit](body)
}
}
|