diff options
Diffstat (limited to 'tests/disabled/macro/run/macroPlugins-typedMacroBody')
5 files changed, 48 insertions, 0 deletions
diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.flags b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.flags new file mode 100644 index 000000000..966df731d --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.flags @@ -0,0 +1 @@ +-Xplugin:.
\ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.scala b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.scala new file mode 100644 index 000000000..80acfec65 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Macros_2.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + def impl1(c: Context) = { + import c.universe._ + q"""println("impl1")""" + } + + def impl2(c: Context) = { + import c.universe._ + q"""println("impl2")""" + } + + def foo1: Unit = macro 1 + + def foo2: Unit = macro 2 +}
\ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/Plugin_1.scala b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Plugin_1.scala new file mode 100644 index 000000000..e99cf7f75 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Plugin_1.scala @@ -0,0 +1,21 @@ +package typedMacroBody + +import scala.tools.nsc.Global +import scala.tools.nsc.plugins.{Plugin => NscPlugin} + +class Plugin(val global: Global) extends NscPlugin { + import global._ + import analyzer._ + + val name = "typedMacroBody" + val description = "A sample analyzer plugin that overrides typedMacroBody." + val components = Nil + addMacroPlugin(MacroPlugin) + + object MacroPlugin extends MacroPlugin { + override def pluginsTypedMacroBody(typer: Typer, ddef: DefDef): Option[Tree] = { + val DefDef(_, _, _, _, _, Literal(Constant(num: Int))) = ddef + Some(standardTypedMacroBody(typer, copyDefDef(ddef)(rhs = Ident(TermName("impl" + num))))) + } + } +}
\ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/Test_3.scala b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Test_3.scala new file mode 100644 index 000000000..a730821f2 --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/Test_3.scala @@ -0,0 +1,4 @@ +object Test extends dotty.runtime.LegacyApp { + Macros.foo1 + Macros.foo2 +}
\ No newline at end of file diff --git a/tests/disabled/macro/run/macroPlugins-typedMacroBody/scalac-plugin.xml b/tests/disabled/macro/run/macroPlugins-typedMacroBody/scalac-plugin.xml new file mode 100644 index 000000000..e223fa5dc --- /dev/null +++ b/tests/disabled/macro/run/macroPlugins-typedMacroBody/scalac-plugin.xml @@ -0,0 +1,4 @@ +<plugin> + <name>typed-macro-body</name> + <classname>typedMacroBody.Plugin</classname> +</plugin>
\ No newline at end of file |