summaryrefslogtreecommitdiff
path: root/test/files/run/t7008
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/t7008')
-rw-r--r--test/files/run/t7008/Impls_Macros_1.scala12
-rw-r--r--test/files/run/t7008/Test_2.scala9
2 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/t7008/Impls_Macros_1.scala b/test/files/run/t7008/Impls_Macros_1.scala
new file mode 100644
index 0000000000..f2eb7425f5
--- /dev/null
+++ b/test/files/run/t7008/Impls_Macros_1.scala
@@ -0,0 +1,12 @@
+import language.experimental.macros
+import scala.reflect.macros.Context
+
+object Macros {
+ def impl(c: Context) = {
+ val decls = c.typeOf[JavaClassWithCheckedExceptions[_]].declarations.toList
+ val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL)
+ c.universe.reify(println(c.literal(s).splice))
+ }
+
+ def foo = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/t7008/Test_2.scala b/test/files/run/t7008/Test_2.scala
new file mode 100644
index 0000000000..b67faa327f
--- /dev/null
+++ b/test/files/run/t7008/Test_2.scala
@@ -0,0 +1,9 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ Macros.foo
+ println("=============")
+
+ val decls = typeOf[JavaClassWithCheckedExceptions[_]].declarations.toList
+ decls sortBy (_.name.toString) foreach (decl => println(s"${decl.name}: ${decl.annotations}"))
+} \ No newline at end of file