summaryrefslogtreecommitdiff
path: root/test/files/neg/t6539
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-11-06 22:23:09 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-11-06 22:31:50 +0100
commit6902da3168c02448387edc000dedfe97ef5f7cd9 (patch)
tree4110e85872ce34f79c73bef7e5b6a2e3130b0a8f /test/files/neg/t6539
parent3b68b45a200087104a1ac2de7c4b86635023fd4d (diff)
downloadscala-6902da3168c02448387edc000dedfe97ef5f7cd9.tar.gz
scala-6902da3168c02448387edc000dedfe97ef5f7cd9.tar.bz2
scala-6902da3168c02448387edc000dedfe97ef5f7cd9.zip
SI-6539 Annotation for methods unfit for post-typer ASTs
Motivated by the `.value` method in the SBT task-syntax branch, which should only be called within the context of the argument to a setting initialization macro. The facility is akin to a fatal deprecation.
Diffstat (limited to 'test/files/neg/t6539')
-rw-r--r--test/files/neg/t6539/Macro_1.scala10
-rw-r--r--test/files/neg/t6539/Test_2.scala6
2 files changed, 16 insertions, 0 deletions
diff --git a/test/files/neg/t6539/Macro_1.scala b/test/files/neg/t6539/Macro_1.scala
new file mode 100644
index 0000000000..69bd53fe07
--- /dev/null
+++ b/test/files/neg/t6539/Macro_1.scala
@@ -0,0 +1,10 @@
+import language.experimental.macros
+import reflect.macros.Context
+
+object M {
+ def m(a: Any, b: Any): Any = macro mImpl
+ def mImpl(c: Context)(a: c.Expr[Any], b: c.Expr[Any]) = a
+
+ @reflect.macros.compileTimeOnly("cto may only be used as an argument to m")
+ def cto = 0
+}
diff --git a/test/files/neg/t6539/Test_2.scala b/test/files/neg/t6539/Test_2.scala
new file mode 100644
index 0000000000..1569c79788
--- /dev/null
+++ b/test/files/neg/t6539/Test_2.scala
@@ -0,0 +1,6 @@
+object Test {
+ M.cto // error
+ M.m(M.cto, ()) // error
+ M.m((), M.cto) // okay
+ M.cto // error
+} \ No newline at end of file