summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/macro-bundle-abstract.check4
-rw-r--r--test/files/neg/macro-bundle-abstract.scala12
-rw-r--r--test/files/neg/macro-bundle-class.check4
-rw-r--r--test/files/neg/macro-bundle-class.scala11
-rw-r--r--test/files/neg/macro-bundle-nonmacro.check4
-rw-r--r--test/files/neg/macro-bundle-nonmacro.scala9
-rw-r--r--test/files/neg/macro-bundle-object.check7
-rw-r--r--test/files/neg/macro-bundle-object.scala12
-rw-r--r--test/files/neg/macro-bundle-polymorphic.check10
-rw-r--r--test/files/neg/macro-bundle-polymorphic.scala13
-rw-r--r--test/files/neg/macro-bundle-trait.check4
-rw-r--r--test/files/neg/macro-bundle-trait.scala12
-rw-r--r--test/files/run/macro-bundle-static.check6
-rw-r--r--test/files/run/macro-bundle-static/Impls_Macros_1.scala31
-rw-r--r--test/files/run/macro-bundle-static/Test_2.scala8
-rw-r--r--test/files/run/macro-bundle-toplevel.check6
-rw-r--r--test/files/run/macro-bundle-toplevel.flags (renamed from test/files/run/macro-bundle.flags)0
-rw-r--r--test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala (renamed from test/files/run/macro-bundle/Impls_Macros_1.scala)13
-rw-r--r--test/files/run/macro-bundle-toplevel/Test_2.scala (renamed from test/files/run/macro-bundle/Test_2.scala)3
-rw-r--r--test/files/run/macro-bundle.check3
20 files changed, 169 insertions, 3 deletions
diff --git a/test/files/neg/macro-bundle-abstract.check b/test/files/neg/macro-bundle-abstract.check
new file mode 100644
index 0000000000..4b07adcc95
--- /dev/null
+++ b/test/files/neg/macro-bundle-abstract.check
@@ -0,0 +1,4 @@
+macro-bundle-abstract.scala:5: error: class Bundle$Bundle needs to be abstract, since method deferred in trait Bundle of type => Int is not defined
+trait Bundle extends Macro {
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-abstract.scala b/test/files/neg/macro-bundle-abstract.scala
new file mode 100644
index 0000000000..2b302045da
--- /dev/null
+++ b/test/files/neg/macro-bundle-abstract.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+trait Bundle extends Macro {
+ def deferred: Int
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-class.check b/test/files/neg/macro-bundle-class.check
new file mode 100644
index 0000000000..92695390ab
--- /dev/null
+++ b/test/files/neg/macro-bundle-class.check
@@ -0,0 +1,4 @@
+macro-bundle-class.scala:10: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-class.scala b/test/files/neg/macro-bundle-class.scala
new file mode 100644
index 0000000000..4b92cdd40f
--- /dev/null
+++ b/test/files/neg/macro-bundle-class.scala
@@ -0,0 +1,11 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+class Bundle(val c: Context) extends Macro {
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-nonmacro.check b/test/files/neg/macro-bundle-nonmacro.check
new file mode 100644
index 0000000000..5a265b5724
--- /dev/null
+++ b/test/files/neg/macro-bundle-nonmacro.check
@@ -0,0 +1,4 @@
+macro-bundle-nonmacro.scala:8: error: not found: value Bundle
+ def foo = Bundle.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-nonmacro.scala b/test/files/neg/macro-bundle-nonmacro.scala
new file mode 100644
index 0000000000..c7d99f4582
--- /dev/null
+++ b/test/files/neg/macro-bundle-nonmacro.scala
@@ -0,0 +1,9 @@
+import scala.language.experimental.macros
+
+trait Bundle {
+ def impl = ???
+}
+
+object Macros {
+ def foo = Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-object.check b/test/files/neg/macro-bundle-object.check
new file mode 100644
index 0000000000..e122001427
--- /dev/null
+++ b/test/files/neg/macro-bundle-object.check
@@ -0,0 +1,7 @@
+macro-bundle-object.scala:11: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.macros.Context): c.Expr[Any]
+ found : : Nothing
+number of parameter sections differ
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-object.scala b/test/files/neg/macro-bundle-object.scala
new file mode 100644
index 0000000000..98c4238a62
--- /dev/null
+++ b/test/files/neg/macro-bundle-object.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+object Bundle extends Macro {
+ val c: Context = ???
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-polymorphic.check b/test/files/neg/macro-bundle-polymorphic.check
new file mode 100644
index 0000000000..204bd30bca
--- /dev/null
+++ b/test/files/neg/macro-bundle-polymorphic.check
@@ -0,0 +1,10 @@
+macro-bundle-polymorphic.scala:10: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle.impl
+ ^
+macro-bundle-polymorphic.scala:11: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle[Int].impl
+ ^
+macro-bundle-polymorphic.scala:12: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle[Int, Nothing].impl
+ ^
+three errors found
diff --git a/test/files/neg/macro-bundle-polymorphic.scala b/test/files/neg/macro-bundle-polymorphic.scala
new file mode 100644
index 0000000000..0468d841bd
--- /dev/null
+++ b/test/files/neg/macro-bundle-polymorphic.scala
@@ -0,0 +1,13 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+trait Bundle[T] extends Macro {
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+ def foo = macro Bundle[Int].impl
+ def foo = macro Bundle[Int, Nothing].impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-bundle-trait.check b/test/files/neg/macro-bundle-trait.check
new file mode 100644
index 0000000000..972788c577
--- /dev/null
+++ b/test/files/neg/macro-bundle-trait.check
@@ -0,0 +1,4 @@
+macro-bundle-trait.scala:11: error: macro bundles must be monomorphic traits extending scala.reflect.macros.Macro and not implementing its `val c: Context` member
+ def foo = macro Bundle.impl
+ ^
+one error found
diff --git a/test/files/neg/macro-bundle-trait.scala b/test/files/neg/macro-bundle-trait.scala
new file mode 100644
index 0000000000..ddc87f6db3
--- /dev/null
+++ b/test/files/neg/macro-bundle-trait.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Macro
+import scala.reflect.macros.Context
+
+trait Bundle extends Macro {
+ val c: Context = ???
+ def impl = ???
+}
+
+object Macros {
+ def foo = macro Bundle.impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-static.check b/test/files/run/macro-bundle-static.check
new file mode 100644
index 0000000000..37c8eaf27a
--- /dev/null
+++ b/test/files/run/macro-bundle-static.check
@@ -0,0 +1,6 @@
+()
+Int
+()
+true
+IntInt
+true
diff --git a/test/files/run/macro-bundle-static/Impls_Macros_1.scala b/test/files/run/macro-bundle-static/Impls_Macros_1.scala
new file mode 100644
index 0000000000..831dac6df5
--- /dev/null
+++ b/test/files/run/macro-bundle-static/Impls_Macros_1.scala
@@ -0,0 +1,31 @@
+import scala.reflect.macros.Context
+import scala.reflect.macros.Macro
+import scala.language.experimental.macros
+
+object Enclosing {
+ trait Impl extends Macro {
+ def mono = c.literalUnit
+ def poly[T: c.WeakTypeTag] = c.literal(c.weakTypeOf[T].toString)
+ def weird = macro mono
+ }
+}
+
+object Macros {
+ def mono = macro Enclosing.Impl.mono
+ def poly[T] = macro Enclosing.Impl.poly[T]
+}
+
+package pkg {
+ object Enclosing {
+ trait Impl extends Macro {
+ def mono = c.literalTrue
+ def poly[T: c.WeakTypeTag] = c.literal(c.weakTypeOf[T].toString + c.weakTypeOf[T].toString)
+ def weird = macro mono
+ }
+ }
+
+ object Macros {
+ def mono = macro Enclosing.Impl.mono
+ def poly[T] = macro Enclosing.Impl.poly[T]
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-static/Test_2.scala b/test/files/run/macro-bundle-static/Test_2.scala
new file mode 100644
index 0000000000..72160f6ec2
--- /dev/null
+++ b/test/files/run/macro-bundle-static/Test_2.scala
@@ -0,0 +1,8 @@
+object Test extends App {
+ println(Macros.mono)
+ println(Macros.poly[Int])
+ println(new Enclosing.Impl{val c = ???}.weird)
+ println(pkg.Macros.mono)
+ println(pkg.Macros.poly[Int])
+ println(new pkg.Enclosing.Impl{val c = ???}.weird)
+} \ No newline at end of file
diff --git a/test/files/run/macro-bundle-toplevel.check b/test/files/run/macro-bundle-toplevel.check
new file mode 100644
index 0000000000..37c8eaf27a
--- /dev/null
+++ b/test/files/run/macro-bundle-toplevel.check
@@ -0,0 +1,6 @@
+()
+Int
+()
+true
+IntInt
+true
diff --git a/test/files/run/macro-bundle.flags b/test/files/run/macro-bundle-toplevel.flags
index cd66464f2f..cd66464f2f 100644
--- a/test/files/run/macro-bundle.flags
+++ b/test/files/run/macro-bundle-toplevel.flags
diff --git a/test/files/run/macro-bundle/Impls_Macros_1.scala b/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
index 3f651c9a43..676935682e 100644
--- a/test/files/run/macro-bundle/Impls_Macros_1.scala
+++ b/test/files/run/macro-bundle-toplevel/Impls_Macros_1.scala
@@ -10,4 +10,17 @@ trait Impl extends Macro {
object Macros {
def mono = macro Impl.mono
def poly[T] = macro Impl.poly[T]
+}
+
+package pkg {
+ trait Impl extends Macro {
+ def mono = c.literalTrue
+ def poly[T: c.WeakTypeTag] = c.literal(c.weakTypeOf[T].toString + c.weakTypeOf[T].toString)
+ def weird = macro mono
+ }
+
+ object Macros {
+ def mono = macro Impl.mono
+ def poly[T] = macro Impl.poly[T]
+ }
} \ No newline at end of file
diff --git a/test/files/run/macro-bundle/Test_2.scala b/test/files/run/macro-bundle-toplevel/Test_2.scala
index 428f809f9d..139cc5bef2 100644
--- a/test/files/run/macro-bundle/Test_2.scala
+++ b/test/files/run/macro-bundle-toplevel/Test_2.scala
@@ -2,4 +2,7 @@ object Test extends App {
println(Macros.mono)
println(Macros.poly[Int])
println(new Impl{val c = ???}.weird)
+ println(pkg.Macros.mono)
+ println(pkg.Macros.poly[Int])
+ println(new pkg.Impl{val c = ???}.weird)
} \ No newline at end of file
diff --git a/test/files/run/macro-bundle.check b/test/files/run/macro-bundle.check
deleted file mode 100644
index 2107454960..0000000000
--- a/test/files/run/macro-bundle.check
+++ /dev/null
@@ -1,3 +0,0 @@
-()
-Int
-()