summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/compile-time-only-b.check8
-rw-r--r--test/files/neg/macro-reify-splice-splice.check7
-rw-r--r--test/files/neg/macro-reify-splice-splice.flags1
-rw-r--r--test/files/neg/macro-reify-splice-splice/Macros_1.scala11
-rw-r--r--test/files/neg/macro-reify-splice-splice/Test_2.scala3
-rw-r--r--test/files/neg/t6539.check8
6 files changed, 36 insertions, 2 deletions
diff --git a/test/files/neg/compile-time-only-b.check b/test/files/neg/compile-time-only-b.check
index 8292a0ddeb..50cdf57fb5 100644
--- a/test/files/neg/compile-time-only-b.check
+++ b/test/files/neg/compile-time-only-b.check
@@ -1,7 +1,13 @@
+compile-time-only-b.scala:9: error: splice must be enclosed within a reify {} block
+ val ignored1 = expr.splice
+ ^
+compile-time-only-b.scala:10: error: cannot use value except for signatures of macro implementations
+ val ignored2 = expr.value
+ ^
compile-time-only-b.scala:13: error: splice must be enclosed within a reify {} block
val ignored3 = reify(fortyTwo).splice
^
compile-time-only-b.scala:14: error: cannot use value except for signatures of macro implementations
val ignored4 = reify(fortyTwo).value
^
-two errors found
+four errors found
diff --git a/test/files/neg/macro-reify-splice-splice.check b/test/files/neg/macro-reify-splice-splice.check
new file mode 100644
index 0000000000..bd1ea7acee
--- /dev/null
+++ b/test/files/neg/macro-reify-splice-splice.check
@@ -0,0 +1,7 @@
+Macros_1.scala:8: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved.
+cross-stage evaluations need to be invoked explicitly, so we're showing you this error.
+if you're sure this is not an oversight, add scala-compiler.jar to the classpath,
+import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead.
+ { c.universe.reify(c.universe.reify("hello world")) }.splice.splice
+ ^
+one error found
diff --git a/test/files/neg/macro-reify-splice-splice.flags b/test/files/neg/macro-reify-splice-splice.flags
new file mode 100644
index 0000000000..cd66464f2f
--- /dev/null
+++ b/test/files/neg/macro-reify-splice-splice.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/test/files/neg/macro-reify-splice-splice/Macros_1.scala b/test/files/neg/macro-reify-splice-splice/Macros_1.scala
new file mode 100644
index 0000000000..691f22ad07
--- /dev/null
+++ b/test/files/neg/macro-reify-splice-splice/Macros_1.scala
@@ -0,0 +1,11 @@
+import scala.reflect.macros.{BlackboxContext => Ctx}
+
+object Macros {
+ def foo = macro Impls.foo
+
+ object Impls {
+ def foo(c: Ctx) = c.universe.reify {
+ { c.universe.reify(c.universe.reify("hello world")) }.splice.splice
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/macro-reify-splice-splice/Test_2.scala b/test/files/neg/macro-reify-splice-splice/Test_2.scala
new file mode 100644
index 0000000000..f697da6020
--- /dev/null
+++ b/test/files/neg/macro-reify-splice-splice/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ println(Macros.foo)
+} \ No newline at end of file
diff --git a/test/files/neg/t6539.check b/test/files/neg/t6539.check
index b647636338..8c94a8ad4c 100644
--- a/test/files/neg/t6539.check
+++ b/test/files/neg/t6539.check
@@ -7,4 +7,10 @@ Test_2.scala:3: error: cto may only be used as an argument to m
Test_2.scala:5: error: cto may only be used as an argument to m
M.cto // error
^
-three errors found
+Test_2.scala:9: error: splice must be enclosed within a reify {} block
+ val splice = expr.splice
+ ^
+Test_2.scala:10: error: cannot use value except for signatures of macro implementations
+ val value = expr.value
+ ^
+5 errors found