summaryrefslogtreecommitdiff
path: root/test/files/run/macro-enclosures
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/macro-enclosures')
-rw-r--r--test/files/run/macro-enclosures/Impls_Macros_1.scala14
-rw-r--r--test/files/run/macro-enclosures/Test_2.scala11
2 files changed, 25 insertions, 0 deletions
diff --git a/test/files/run/macro-enclosures/Impls_Macros_1.scala b/test/files/run/macro-enclosures/Impls_Macros_1.scala
new file mode 100644
index 0000000000..cd54028676
--- /dev/null
+++ b/test/files/run/macro-enclosures/Impls_Macros_1.scala
@@ -0,0 +1,14 @@
+import scala.reflect.macros.Context
+
+object Macros {
+ def impl(c: Context) = c.universe.reify {
+ println("enclosingPackage = " + c.literal(c.enclosingPackage.toString).splice)
+ println("enclosingClass = " + c.literal(c.enclosingClass.toString).splice)
+ println("enclosingImpl = " + c.literal(c.enclosingImpl.toString).splice)
+ println("enclosingTemplate = " + c.literal(c.enclosingTemplate.toString).splice)
+ println("enclosingMethod = " + c.literal(c.enclosingMethod.toString).splice)
+ println("enclosingDef = " + c.literal(c.enclosingDef.toString).splice)
+ }
+
+ def foo = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-enclosures/Test_2.scala b/test/files/run/macro-enclosures/Test_2.scala
new file mode 100644
index 0000000000..779fe5211e
--- /dev/null
+++ b/test/files/run/macro-enclosures/Test_2.scala
@@ -0,0 +1,11 @@
+object Test extends App {
+ test.Test.test
+}
+
+package test {
+ object Test {
+ def test = {
+ Macros.foo
+ }
+ }
+} \ No newline at end of file