diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-08-10 15:16:09 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-08-16 19:20:18 +0200 |
commit | 4a273659e0e25ccfe7ea9d4eafa4a9c87ee2fc82 (patch) | |
tree | ec6fbd3100fb8adb1d98dd31d6fe6872d114775b /test/files/run/macro-toplevel | |
parent | 83e95c0fa5168e64299d85b081b21c577ce4e8ef (diff) | |
download | scala-4a273659e0e25ccfe7ea9d4eafa4a9c87ee2fc82.tar.gz scala-4a273659e0e25ccfe7ea9d4eafa4a9c87ee2fc82.tar.bz2 scala-4a273659e0e25ccfe7ea9d4eafa4a9c87ee2fc82.zip |
kills introduceTopLevel
As we've figured out from the practice, introduceTopLevel is seductively
useful but unfortunately not robust, potentially bringing compilation
order problems.
Therefore, as discussed, I'm removing it from the public macro API.
Alternatives are either: 1) delving into internals, or
2) using macro paradise and experimenting with macro annotations:
http://docs.scala-lang.org/overviews/macros/annotations.html.
Diffstat (limited to 'test/files/run/macro-toplevel')
-rw-r--r-- | test/files/run/macro-toplevel/Macros_1.scala | 15 | ||||
-rw-r--r-- | test/files/run/macro-toplevel/Test_2.scala | 6 |
2 files changed, 0 insertions, 21 deletions
diff --git a/test/files/run/macro-toplevel/Macros_1.scala b/test/files/run/macro-toplevel/Macros_1.scala deleted file mode 100644 index f681c86735..0000000000 --- a/test/files/run/macro-toplevel/Macros_1.scala +++ /dev/null @@ -1,15 +0,0 @@ -import scala.reflect.macros.Context -import language.experimental.macros - -object Macros { - def impl(c: Context) = { - import c.universe._ - val msg = "I've been created from " + c.macroApplication - val Block(List(synthetic: ClassDef), _) = reify{ class SomeUniqueName { def hello = c.literal(msg).splice } }.tree - val ref = c.topLevelRef(synthetic.name) orElse c.introduceTopLevel(nme.EMPTY_PACKAGE_NAME.toString, synthetic) - c.Expr[String](Select(Apply(Select(New(ref), nme.CONSTRUCTOR), List()), TermName("hello"))) - } - - def foo = macro impl - def foo2 = macro impl -} diff --git a/test/files/run/macro-toplevel/Test_2.scala b/test/files/run/macro-toplevel/Test_2.scala deleted file mode 100644 index eee2d6ae13..0000000000 --- a/test/files/run/macro-toplevel/Test_2.scala +++ /dev/null @@ -1,6 +0,0 @@ -import Macros._ - -object Test extends App { - println(Macros.foo) - println(Macros.foo2) -}
\ No newline at end of file |