diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-06-27 16:04:37 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-06-27 16:04:37 +0200 |
commit | fbfce33cb03bc2b41dd0f46fa9f4630036b4f2ca (patch) | |
tree | 9219c9a2f186d51eceff3c7094412481a4b99b8d /test/files | |
parent | 856fe4ad0472ab71d91a6ab442fba77c4cf9950b (diff) | |
parent | a907887158a469b6a21d027fd37bc360e9009b2f (diff) | |
download | scala-fbfce33cb03bc2b41dd0f46fa9f4630036b4f2ca.tar.gz scala-fbfce33cb03bc2b41dd0f46fa9f4630036b4f2ca.tar.bz2 scala-fbfce33cb03bc2b41dd0f46fa9f4630036b4f2ca.zip |
Merge pull request #3778 from xeno-by/topic/plugins-is-blackbox
adds MacroPlugin.pluginsIsBlackbox
Diffstat (limited to 'test/files')
5 files changed, 40 insertions, 0 deletions
diff --git a/test/files/run/macroPlugins-isBlackbox/Macros_2.scala b/test/files/run/macroPlugins-isBlackbox/Macros_2.scala new file mode 100644 index 0000000000..a90dd702df --- /dev/null +++ b/test/files/run/macroPlugins-isBlackbox/Macros_2.scala @@ -0,0 +1,11 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + q"42" + } + + def foo: Any = macro impl +}
\ No newline at end of file diff --git a/test/files/run/macroPlugins-isBlackbox/Plugin_1.scala b/test/files/run/macroPlugins-isBlackbox/Plugin_1.scala new file mode 100644 index 0000000000..b78a18ea6a --- /dev/null +++ b/test/files/run/macroPlugins-isBlackbox/Plugin_1.scala @@ -0,0 +1,21 @@ +package isblackbox + +import scala.tools.nsc.Global +import scala.tools.nsc.plugins.{Plugin => NscPlugin} + +class Plugin(val global: Global) extends NscPlugin { + import global._ + import analyzer._ + import scala.reflect.internal.Mode + + val name = "isBlackbox" + val description = "A sample analyzer plugin that overrides isBlackbox." + val components = Nil + addMacroPlugin(MacroPlugin) + + object MacroPlugin extends MacroPlugin { + override def pluginsIsBlackbox(macroDef: Symbol): Option[Boolean] = { + Some(false) + } + } +}
\ No newline at end of file diff --git a/test/files/run/macroPlugins-isBlackbox/Test_3.flags b/test/files/run/macroPlugins-isBlackbox/Test_3.flags new file mode 100644 index 0000000000..966df731d0 --- /dev/null +++ b/test/files/run/macroPlugins-isBlackbox/Test_3.flags @@ -0,0 +1 @@ +-Xplugin:.
\ No newline at end of file diff --git a/test/files/run/macroPlugins-isBlackbox/Test_3.scala b/test/files/run/macroPlugins-isBlackbox/Test_3.scala new file mode 100644 index 0000000000..552e888143 --- /dev/null +++ b/test/files/run/macroPlugins-isBlackbox/Test_3.scala @@ -0,0 +1,3 @@ +object Test extends App { + val x: Int = Macros.foo +}
\ No newline at end of file diff --git a/test/files/run/macroPlugins-isBlackbox/scalac-plugin.xml b/test/files/run/macroPlugins-isBlackbox/scalac-plugin.xml new file mode 100644 index 0000000000..09b9c14648 --- /dev/null +++ b/test/files/run/macroPlugins-isBlackbox/scalac-plugin.xml @@ -0,0 +1,4 @@ +<plugin> + <name>is-blackbox</name> + <classname>isblackbox.Plugin</classname> +</plugin>
\ No newline at end of file |