summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t5689.check7
-rw-r--r--test/files/neg/t5689.flags1
-rw-r--r--test/files/neg/t5689.scala6
-rw-r--r--test/files/run/t5680.check3
-rw-r--r--test/files/run/t5680.scala7
5 files changed, 24 insertions, 0 deletions
diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check
new file mode 100644
index 0000000000..f286d08cfa
--- /dev/null
+++ b/test/files/neg/t5689.check
@@ -0,0 +1,7 @@
+t5689.scala:4: error: macro implementation has wrong shape:
+ required: (c: scala.reflect.makro.Context)(i: c.Expr[Double]): c.Expr[String]
+ found : (c: scala.reflect.makro.Context)(i: c.Expr[Double]): c.Expr[Int]
+type mismatch for return type : c.Expr[String] does not conform to c.Expr[Int]
+ def returnsString(i: Double): String = macro returnsIntImpl
+ ^
+one error found
diff --git a/test/files/neg/t5689.flags b/test/files/neg/t5689.flags
new file mode 100644
index 0000000000..cd66464f2f
--- /dev/null
+++ b/test/files/neg/t5689.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/test/files/neg/t5689.scala b/test/files/neg/t5689.scala
new file mode 100644
index 0000000000..ef7a45b364
--- /dev/null
+++ b/test/files/neg/t5689.scala
@@ -0,0 +1,6 @@
+import scala.reflect.makro.Context
+
+object Macros {
+ def returnsString(i: Double): String = macro returnsIntImpl
+ def returnsIntImpl(c: Context)(i: c.Expr[Double]): c.Expr[Int] = ???
+}
diff --git a/test/files/run/t5680.check b/test/files/run/t5680.check
new file mode 100644
index 0000000000..9fec3b6505
--- /dev/null
+++ b/test/files/run/t5680.check
@@ -0,0 +1,3 @@
+[Lscala.runtime.BoxedUnit
+()
+()
diff --git a/test/files/run/t5680.scala b/test/files/run/t5680.scala
new file mode 100644
index 0000000000..f61cbd6e20
--- /dev/null
+++ b/test/files/run/t5680.scala
@@ -0,0 +1,7 @@
+object Test extends App {
+ val x = Array[Unit]((), ())
+ println(x.toString.substring(0, x.toString.indexOf(";")))
+ println(x(0))
+ x(1) = ()
+ println(x(1))
+} \ No newline at end of file