diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-12-25 02:08:21 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-12-25 02:31:15 +0100 |
commit | 2375e2d878e6c493d9ab3097ef1d13d8641a6209 (patch) | |
tree | c0953cdb7e61a5e9940ee2d8c757b839a19f7028 /test/files | |
parent | d2a7aa4ba1c048e52affb0eb2b9167a18dc29c83 (diff) | |
download | scala-2375e2d878e6c493d9ab3097ef1d13d8641a6209.tar.gz scala-2375e2d878e6c493d9ab3097ef1d13d8641a6209.tar.bz2 scala-2375e2d878e6c493d9ab3097ef1d13d8641a6209.zip |
enclosures are now strongly typed and are no longer vals
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/macro-enclosures.check | 32 | ||||
-rw-r--r-- | test/files/run/macro-enclosures.flags | 1 | ||||
-rw-r--r-- | test/files/run/macro-enclosures/Impls_Macros_1.scala | 14 | ||||
-rw-r--r-- | test/files/run/macro-enclosures/Test_2.scala | 11 | ||||
-rw-r--r-- | test/files/run/t6394a/Macros_1.scala | 2 |
5 files changed, 59 insertions, 1 deletions
diff --git a/test/files/run/macro-enclosures.check b/test/files/run/macro-enclosures.check new file mode 100644 index 0000000000..36bb67e194 --- /dev/null +++ b/test/files/run/macro-enclosures.check @@ -0,0 +1,32 @@ +enclosingPackage = package test { + object Test extends scala.AnyRef { + def <init>() = { + super.<init>(); + () + }; + def test = Macros.foo + } +} +enclosingClass = object Test extends scala.AnyRef { + def <init>() = { + super.<init>(); + () + }; + def test = Macros.foo +} +enclosingImpl = object Test extends scala.AnyRef { + def <init>() = { + super.<init>(); + () + }; + def test = Macros.foo +} +enclosingTemplate = scala.AnyRef { + def <init>() = { + super.<init>(); + () + }; + def test = Macros.foo +} +enclosingMethod = def test = Macros.foo +enclosingDef = def test = Macros.foo diff --git a/test/files/run/macro-enclosures.flags b/test/files/run/macro-enclosures.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-enclosures.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file 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 diff --git a/test/files/run/t6394a/Macros_1.scala b/test/files/run/t6394a/Macros_1.scala index 3d39d3e40a..5aa07e7f41 100644 --- a/test/files/run/t6394a/Macros_1.scala +++ b/test/files/run/t6394a/Macros_1.scala @@ -4,7 +4,7 @@ object Macros { def impl(c:Context): c.Expr[Any] = { import c.universe._ - val selfTree = This(c.enclosingClass.symbol.asModule.moduleClass) + val selfTree = This(c.enclosingImpl.symbol.asModule.moduleClass) c.Expr[AnyRef](selfTree) } |