summaryrefslogtreecommitdiff
path: root/test/files/run/macro-bundle-repl.check
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-10-02 16:47:11 +0200
committerEugene Burmako <xeno.by@gmail.com>2013-10-02 22:46:01 +0200
commitfe074bbca1a9a3ae7d46301d652c5bf0f34e2c6e (patch)
tree402d565771638ee12625b1a0fdb7d441e434bc5d /test/files/run/macro-bundle-repl.check
parent5db26e5136c635af062801218fc7edec280e63ff (diff)
downloadscala-fe074bbca1a9a3ae7d46301d652c5bf0f34e2c6e.tar.gz
scala-fe074bbca1a9a3ae7d46301d652c5bf0f34e2c6e.tar.bz2
scala-fe074bbca1a9a3ae7d46301d652c5bf0f34e2c6e.zip
macro bundles are now usable in repl
One of the previous commits relaxed the top-level restriction for bundles, turning it into a requirement of staticness (i.e. bundles nested in static objects are also okay now). This means that we can now define bundles in repl. Almost. There's still a little problem remaining that arises from the fact that when compiling a line of input, repl doesn't automatically import all previously defined symbols, but rather uses an heuristic to scan the input and guess what symbols need to be imported. Unfortunately for bundles, this heuristic fails, because when scanning a macro definition that looks like `def foo = macro Macros.foo`, it thinks that it's only necessary to import a term symbol called Macros (a vanilla way of defining macro impls), but not a type symbol called Macros (a new way of writing macro impls in bundles). This commit fixes the problem by making the repl look for both term and type symbols corresponding to the identifiers used in macro definitions.
Diffstat (limited to 'test/files/run/macro-bundle-repl.check')
-rw-r--r--test/files/run/macro-bundle-repl.check24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/files/run/macro-bundle-repl.check b/test/files/run/macro-bundle-repl.check
new file mode 100644
index 0000000000..b9c809f037
--- /dev/null
+++ b/test/files/run/macro-bundle-repl.check
@@ -0,0 +1,24 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> import scala.language.experimental.macros
+import scala.language.experimental.macros
+
+scala> import scala.reflect.macros.Macro
+import scala.reflect.macros.Macro
+
+scala> trait Bar extends Macro { def impl = c.literalUnit };def bar = macro Bar.impl
+defined trait Bar
+defined term macro bar: Unit
+
+scala> bar
+
+scala> trait Foo extends Macro { def impl = c.literalUnit }
+defined trait Foo
+
+scala> def foo = macro Foo.impl
+defined term macro foo: Unit
+
+scala> foo
+
+scala>