summaryrefslogtreecommitdiff
path: root/test/files/run/macro-term-declared-in-default-param
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-01-14 23:55:25 +0100
committerEugene Burmako <xeno.by@gmail.com>2013-05-28 08:23:44 +0200
commit70f001181734f76064d97ec25b1afd6aad49b684 (patch)
treecfd16d6df0388c26a0f05f6155a53f8c499d77a7 /test/files/run/macro-term-declared-in-default-param
parente1d9805c91dbe74317e2f4f22ad59056d64d12b3 (diff)
downloadscala-70f001181734f76064d97ec25b1afd6aad49b684.tar.gz
scala-70f001181734f76064d97ec25b1afd6aad49b684.tar.bz2
scala-70f001181734f76064d97ec25b1afd6aad49b684.zip
refactors macro tests
putting in a nutshell, this patch: * condenses some macro-XXX-a/b/c/... bundles * renames some tests to prepare for other macro flavors * introduces some additional tests
Diffstat (limited to 'test/files/run/macro-term-declared-in-default-param')
-rw-r--r--test/files/run/macro-term-declared-in-default-param/Impls_1.scala11
-rw-r--r--test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala7
2 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/macro-term-declared-in-default-param/Impls_1.scala b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala
new file mode 100644
index 0000000000..4380f40b04
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.{Context => Ctx}
+
+object Impls {
+ def foo(c: Ctx) = {
+ 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("it works")))
+ c.Expr[String](body)
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala
new file mode 100644
index 0000000000..356029e63e
--- /dev/null
+++ b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala
@@ -0,0 +1,7 @@
+object Test extends App {
+ def foo(bar: String = { def foo = macro Impls.foo; foo }) = println(bar)
+
+ foo()
+ foo("it works")
+ foo()
+} \ No newline at end of file