summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-12 12:01:12 +0100
committerEugene Burmako <xeno.by@gmail.com>2014-01-12 18:03:51 +0100
commite36888c3d953048483ccea9a95d5984b54ad6ebc (patch)
treea6ba3268a238acb5310dcfdefcf8234c0b7f6a77 /test/files/neg
parent3a689f5c426436aea716567625fd6167e57bef92 (diff)
downloadscala-e36888c3d953048483ccea9a95d5984b54ad6ebc.tar.gz
scala-e36888c3d953048483ccea9a95d5984b54ad6ebc.tar.bz2
scala-e36888c3d953048483ccea9a95d5984b54ad6ebc.zip
prohibits constructor overloading for macro bundles
As per Jason’s feedback, this commit handles overloaded constructors in macro bundles. The backend now checks that we have a constructor of a correct type. The frontend now prohibits multiple constructors altogether.
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/macro-bundle-abstract.check2
-rw-r--r--test/files/neg/macro-bundle-overloaded.check4
-rw-r--r--test/files/neg/macro-bundle-overloaded.scala12
3 files changed, 17 insertions, 1 deletions
diff --git a/test/files/neg/macro-bundle-abstract.check b/test/files/neg/macro-bundle-abstract.check
index 010d0768c9..3afd079521 100644
--- a/test/files/neg/macro-bundle-abstract.check
+++ b/test/files/neg/macro-bundle-abstract.check
@@ -1,4 +1,4 @@
-macro-bundle-abstract.scala:10: error: macro bundles must be concrete classes having a single `val c: Context` parameter
+macro-bundle-abstract.scala:10: error: macro bundles must be concrete classes having a single constructor with a `val c: Context` parameter
def foo = macro Bundle.impl
^
one error found
diff --git a/test/files/neg/macro-bundle-overloaded.check b/test/files/neg/macro-bundle-overloaded.check
new file mode 100644
index 0000000000..fc94ff0000
--- /dev/null
+++ b/test/files/neg/macro-bundle-overloaded.check
@@ -0,0 +1,4 @@
+macro-bundle-overloaded.scala:11: error: macro bundles must be concrete classes having a single constructor with a `val c: Context` parameter
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-overloaded.scala b/test/files/neg/macro-bundle-overloaded.scala
new file mode 100644
index 0000000000..a4bc66f974
--- /dev/null
+++ b/test/files/neg/macro-bundle-overloaded.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.{Context => BlackboxContext}
+import scala.reflect.macros.whitebox.{Context => WhiteboxContext}
+
+class Bundle(val c: BlackboxContext) {
+ def this(c: WhiteboxContext) = this(c: BlackboxContext)
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+} \ No newline at end of file