diff options
Diffstat (limited to 'test/files/run/macro-term-declared-in-annotation')
3 files changed, 22 insertions, 0 deletions
diff --git a/test/files/run/macro-term-declared-in-annotation/Impls_1.scala b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala new file mode 100644 index 0000000000..c4bcfbc1ba --- /dev/null +++ b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.blackbox.Context + +object Impls { + def foo(c: Context) = { + import c.{prefix => prefix} + import c.universe._ + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Literal(Constant("this is deprecated"))) + c.Expr[String](body) + } +}
\ No newline at end of file diff --git a/test/files/run/macro-term-declared-in-annotation/Macros_2.scala b/test/files/run/macro-term-declared-in-annotation/Macros_2.scala new file mode 100644 index 0000000000..40d71c62fb --- /dev/null +++ b/test/files/run/macro-term-declared-in-annotation/Macros_2.scala @@ -0,0 +1,8 @@ +class foo(val bar: String) extends annotation.StaticAnnotation + +object Api { + // foo in ann must have a different name + // otherwise, we get bitten by https://issues.scala-lang.org/browse/SI-5544 + @foo({def fooInAnn = macro Impls.foo; fooInAnn}) + def foo = println("it works") +}
\ No newline at end of file diff --git a/test/files/run/macro-term-declared-in-annotation/Test_3.scala b/test/files/run/macro-term-declared-in-annotation/Test_3.scala new file mode 100644 index 0000000000..866487f028 --- /dev/null +++ b/test/files/run/macro-term-declared-in-annotation/Test_3.scala @@ -0,0 +1,3 @@ +object Test extends App { + Api.foo +}
\ No newline at end of file |