diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-09-20 13:06:03 -0700 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-09-20 13:06:03 -0700 |
commit | c8e6f8e64c4d9967cee41486cc2e324da0262976 (patch) | |
tree | ec15cb3904ccd7e7b4f820e63f60bd36a9567089 /test/files/run | |
parent | c96db8b555b7c6dd3a011b6a319218a745bd25d0 (diff) | |
parent | 648dae6a504f0a5c24d3a7f6efc996f508a006ce (diff) | |
download | scala-c8e6f8e64c4d9967cee41486cc2e324da0262976.tar.gz scala-c8e6f8e64c4d9967cee41486cc2e324da0262976.tar.bz2 scala-c8e6f8e64c4d9967cee41486cc2e324da0262976.zip |
Merge pull request #1348 from scalamacros/ticket/6394
SI-6394 fixes macros.Context.enclosingClass
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t6394a.check | 1 | ||||
-rw-r--r-- | test/files/run/t6394a.flags | 1 | ||||
-rw-r--r-- | test/files/run/t6394a/Macros_1.scala | 12 | ||||
-rw-r--r-- | test/files/run/t6394a/Test_2.scala | 4 |
4 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/t6394a.check b/test/files/run/t6394a.check new file mode 100644 index 0000000000..34997f71e3 --- /dev/null +++ b/test/files/run/t6394a.check @@ -0,0 +1 @@ +TEST
diff --git a/test/files/run/t6394a.flags b/test/files/run/t6394a.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/t6394a.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/t6394a/Macros_1.scala b/test/files/run/t6394a/Macros_1.scala new file mode 100644 index 0000000000..3d39d3e40a --- /dev/null +++ b/test/files/run/t6394a/Macros_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.Context + +object Macros { + def impl(c:Context): c.Expr[Any] = { + import c.universe._ + + val selfTree = This(c.enclosingClass.symbol.asModule.moduleClass) + c.Expr[AnyRef](selfTree) + } + + def foo: Any = macro impl +}
\ No newline at end of file diff --git a/test/files/run/t6394a/Test_2.scala b/test/files/run/t6394a/Test_2.scala new file mode 100644 index 0000000000..75e84f0e38 --- /dev/null +++ b/test/files/run/t6394a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + println(Macros.foo) + override def toString = "TEST" +}
\ No newline at end of file |