summaryrefslogtreecommitdiff
path: root/test/files/run/typecheck/Macros_1.scala
blob: 850a611ab1c0762512147c6bbc9a22593bf2971b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import scala.reflect.macros.Context
import scala.language.experimental.macros

object Macros {
  def impl(c: Context) = {
    import c.universe._
    val classDef = ClassDef(
      Modifiers(), newTypeName("C"), List(),
      Template(
        List(Select(Ident(newTermName("scala")), newTypeName("AnyRef"))), emptyValDef,
        List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))))))
    c.typeCheck(classDef)
    c.Expr[Any](Literal(Constant(())))
  }

  def foo: Any = macro impl
}