summaryrefslogtreecommitdiff
path: root/test/files/neg/macro-bundle-polymorphic.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-02-21 22:18:09 +0100
committerEugene Burmako <xeno.by@gmail.com>2014-02-21 22:24:31 +0100
commitda1032caa4ee4c780b5fff3056dd816623a53737 (patch)
treebf819b16e339bbcec8ed2d260b86b7abd40efaed /test/files/neg/macro-bundle-polymorphic.scala
parent31b52ed651e58a68d478aabe41c62287b6d4d718 (diff)
downloadscala-da1032caa4ee4c780b5fff3056dd816623a53737.tar.gz
scala-da1032caa4ee4c780b5fff3056dd816623a53737.tar.bz2
scala-da1032caa4ee4c780b5fff3056dd816623a53737.zip
prohibits polymorphic bundles
It's not like they were inducing bugs, but I can't see how polymorphism can be useful for macro bundles, hence imho it's better to reduce the number of degrees of freedom of the system.
Diffstat (limited to 'test/files/neg/macro-bundle-polymorphic.scala')
-rw-r--r--test/files/neg/macro-bundle-polymorphic.scala43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/files/neg/macro-bundle-polymorphic.scala b/test/files/neg/macro-bundle-polymorphic.scala
new file mode 100644
index 0000000000..2ba91aa0c5
--- /dev/null
+++ b/test/files/neg/macro-bundle-polymorphic.scala
@@ -0,0 +1,43 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.{Context => BlackboxContext}
+import scala.reflect.macros.whitebox.{Context => WhiteboxContext}
+
+class BlackboxBundle1[T](val c: BlackboxContext) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class BlackboxBundle2[T <: BlackboxContext](val c: T) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class BlackboxBundle3[T <: BlackboxContext, U <: T](val c: U) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class WhiteboxBundle1[T](val c: WhiteboxContext) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class WhiteboxBundle2[T <: WhiteboxContext](val c: T) {
+ import c.universe._
+ def impl = q"()"
+}
+
+class WhiteboxBundle3[T <: WhiteboxContext, U <: T](val c: U) {
+ import c.universe._
+ def impl = q"()"
+}
+
+object Macros {
+ def black1: Any = macro BlackboxBundle1.impl
+ def black2: Any = macro BlackboxBundle2.impl
+ def black3: Any = macro BlackboxBundle3.impl
+
+ def white1: Any = macro WhiteboxBundle1.impl
+ def white2: Any = macro WhiteboxBundle2.impl
+ def white3: Any = macro WhiteboxBundle3.impl
+} \ No newline at end of file