summaryrefslogtreecommitdiff
path: root/test/files/run/typecheck/Macros_1.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/typecheck/Macros_1.scala')
-rw-r--r--test/files/run/typecheck/Macros_1.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/run/typecheck/Macros_1.scala b/test/files/run/typecheck/Macros_1.scala
new file mode 100644
index 0000000000..850a611ab1
--- /dev/null
+++ b/test/files/run/typecheck/Macros_1.scala
@@ -0,0 +1,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
+} \ No newline at end of file