summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-02-16 16:45:27 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-02-16 16:45:27 +0100
commit6ef6c96eff2f0d2f505d45a1436d73a960193076 (patch)
tree6df5b2255fb4e369059fae1f3efbfdbe9c1506c6 /test/files/neg
parentd300fb6250dc0abdfb74194438bfc778446a9856 (diff)
parenta02e053a5dec134f7c7dc53a2c1091039218237d (diff)
downloadscala-6ef6c96eff2f0d2f505d45a1436d73a960193076.tar.gz
scala-6ef6c96eff2f0d2f505d45a1436d73a960193076.tar.bz2
scala-6ef6c96eff2f0d2f505d45a1436d73a960193076.zip
Merge pull request #3397 from xeno-by/ticket/5920
SI-5920 enables default and named args in macros
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/macro-argc-mismatch.check49
-rw-r--r--test/files/neg/macro-argc-mismatch/Macros_1.scala16
-rw-r--r--test/files/neg/macro-argc-mismatch/Test_2.scala19
-rw-r--r--test/files/neg/macro-invalidusage-badargs.check5
-rw-r--r--test/files/neg/macro-qmarkqmarkqmark.check2
-rw-r--r--test/files/neg/t7157.check36
6 files changed, 112 insertions, 15 deletions
diff --git a/test/files/neg/macro-argc-mismatch.check b/test/files/neg/macro-argc-mismatch.check
new file mode 100644
index 0000000000..617daa890c
--- /dev/null
+++ b/test/files/neg/macro-argc-mismatch.check
@@ -0,0 +1,49 @@
+Test_2.scala:4: error: missing arguments for macro method one in object Macros
+ one
+ ^
+Test_2.scala:5: error: not enough arguments for macro method one: (x: Int)Unit.
+Unspecified value parameter x.
+ one()
+ ^
+Test_2.scala:6: error: too many arguments for macro method one: (x: Int)Unit
+ one(2, 3)
+ ^
+Test_2.scala:7: error: not enough arguments for macro method one: (x: Int)Unit.
+Unspecified value parameter x.
+ one()()
+ ^
+Test_2.scala:8: error: Unit does not take parameters
+ one(1)()
+ ^
+Test_2.scala:10: error: missing arguments for macro method two in object Macros
+ two
+ ^
+Test_2.scala:11: error: not enough arguments for macro method two: (x: Int)(y: Int)Unit.
+Unspecified value parameter x.
+ two()
+ ^
+Test_2.scala:12: error: too many arguments for macro method two: (x: Int)(y: Int)Unit
+ two(2, 3)
+ ^
+Test_2.scala:13: error: not enough arguments for macro method two: (x: Int)(y: Int)Unit.
+Unspecified value parameter x.
+ two()()
+ ^
+Test_2.scala:14: error: missing arguments for macro method two in object Macros
+ two(1)
+ ^
+Test_2.scala:15: error: not enough arguments for macro method two: (y: Int)Unit.
+Unspecified value parameter y.
+ two(1)()
+ ^
+Test_2.scala:16: error: too many arguments for macro method two: (y: Int)Unit
+ two(1)(2, 3)
+ ^
+Test_2.scala:17: error: not enough arguments for macro method two: (y: Int)Unit.
+Unspecified value parameter y.
+ two(1)()()
+ ^
+Test_2.scala:18: error: Unit does not take parameters
+ two(1)(1)()
+ ^
+14 errors found
diff --git a/test/files/neg/macro-argc-mismatch/Macros_1.scala b/test/files/neg/macro-argc-mismatch/Macros_1.scala
new file mode 100644
index 0000000000..4dca644172
--- /dev/null
+++ b/test/files/neg/macro-argc-mismatch/Macros_1.scala
@@ -0,0 +1,16 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def one(x: Int): Unit = macro oneImpl
+ def oneImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"()"
+ }
+
+ def two(x: Int)(y: Int): Unit = macro twoImpl
+ def twoImpl(c: Context)(x: c.Tree)(y: c.Tree) = {
+ import c.universe._
+ q"()"
+ }
+}
diff --git a/test/files/neg/macro-argc-mismatch/Test_2.scala b/test/files/neg/macro-argc-mismatch/Test_2.scala
new file mode 100644
index 0000000000..28f9c35654
--- /dev/null
+++ b/test/files/neg/macro-argc-mismatch/Test_2.scala
@@ -0,0 +1,19 @@
+import Macros._
+
+object Test extends App {
+ one
+ one()
+ one(2, 3)
+ one()()
+ one(1)()
+
+ two
+ two()
+ two(2, 3)
+ two()()
+ two(1)
+ two(1)()
+ two(1)(2, 3)
+ two(1)()()
+ two(1)(1)()
+} \ No newline at end of file
diff --git a/test/files/neg/macro-invalidusage-badargs.check b/test/files/neg/macro-invalidusage-badargs.check
index 4c1115418b..3fd3c53691 100644
--- a/test/files/neg/macro-invalidusage-badargs.check
+++ b/test/files/neg/macro-invalidusage-badargs.check
@@ -3,13 +3,14 @@ Macros_Test_2.scala:5: error: type mismatch;
required: Int
foo("42")
^
-Macros_Test_2.scala:6: error: too few argument lists for macro invocation
+Macros_Test_2.scala:6: error: missing arguments for macro method foo in object Macros
foo
^
Macros_Test_2.scala:7: error: Int does not take parameters
foo(4)(2)
^
-Macros_Test_2.scala:8: error: macro applications do not support named and/or default arguments
+Macros_Test_2.scala:8: error: not enough arguments for macro method foo: (x: Int)Int.
+Unspecified value parameter x.
foo()
^
Macros_Test_2.scala:9: error: too many arguments for macro method foo: (x: Int)Int
diff --git a/test/files/neg/macro-qmarkqmarkqmark.check b/test/files/neg/macro-qmarkqmarkqmark.check
index bc3e25edaf..b4f8ea905f 100644
--- a/test/files/neg/macro-qmarkqmarkqmark.check
+++ b/test/files/neg/macro-qmarkqmarkqmark.check
@@ -1,7 +1,7 @@
macro-qmarkqmarkqmark.scala:5: error: macro implementation is missing
foo1
^
-macro-qmarkqmarkqmark.scala:8: error: too few argument lists for macro invocation
+macro-qmarkqmarkqmark.scala:8: error: missing arguments for macro method foo2 in object Macros
foo2
^
macro-qmarkqmarkqmark.scala:9: error: macro implementation is missing
diff --git a/test/files/neg/t7157.check b/test/files/neg/t7157.check
index c6a7af9a23..3988460d4b 100644
--- a/test/files/neg/t7157.check
+++ b/test/files/neg/t7157.check
@@ -7,7 +7,8 @@ Test_2.scala:6: error: too many arguments for macro method m1_0_0: ()Unit
Test_2.scala:7: error: too many arguments for macro method m1_0_0: ()Unit
m1_0_0(1, 2, 3)
^
-Test_2.scala:9: error: macro applications do not support named and/or default arguments
+Test_2.scala:9: error: not enough arguments for macro method m1_1_1: (x: Int)Unit.
+Unspecified value parameter x.
m1_1_1()
^
Test_2.scala:11: error: too many arguments for macro method m1_1_1: (x: Int)Unit
@@ -16,22 +17,27 @@ Test_2.scala:11: error: too many arguments for macro method m1_1_1: (x: Int)Unit
Test_2.scala:12: error: too many arguments for macro method m1_1_1: (x: Int)Unit
m1_1_1(1, 2, 3)
^
-Test_2.scala:14: error: macro applications do not support named and/or default arguments
+Test_2.scala:14: error: not enough arguments for macro method m1_2_2: (x: Int, y: Int)Unit.
+Unspecified value parameters x, y.
m1_2_2()
^
-Test_2.scala:15: error: macro applications do not support named and/or default arguments
+Test_2.scala:15: error: not enough arguments for macro method m1_2_2: (x: Int, y: Int)Unit.
+Unspecified value parameter y.
m1_2_2(1)
^
Test_2.scala:17: error: too many arguments for macro method m1_2_2: (x: Int, y: Int)Unit
m1_2_2(1, 2, 3)
^
-Test_2.scala:24: error: macro applications do not support named and/or default arguments
+Test_2.scala:24: error: not enough arguments for macro method m1_1_inf: (x: Int, y: Int*)Unit.
+Unspecified value parameters x, y.
m1_1_inf()
^
-Test_2.scala:29: error: macro applications do not support named and/or default arguments
+Test_2.scala:29: error: not enough arguments for macro method m1_2_inf: (x: Int, y: Int, z: Int*)Unit.
+Unspecified value parameters x, y, z.
m1_2_inf()
^
-Test_2.scala:30: error: macro applications do not support named and/or default arguments
+Test_2.scala:30: error: not enough arguments for macro method m1_2_inf: (x: Int, y: Int, z: Int*)Unit.
+Unspecified value parameters y, z.
m1_2_inf(1)
^
Test_2.scala:35: error: too many arguments for macro method m2_0_0: ()Unit
@@ -43,7 +49,8 @@ Test_2.scala:36: error: too many arguments for macro method m2_0_0: ()Unit
Test_2.scala:37: error: too many arguments for macro method m2_0_0: ()Unit
m2_0_0()(1, 2, 3)
^
-Test_2.scala:39: error: macro applications do not support named and/or default arguments
+Test_2.scala:39: error: not enough arguments for macro method m2_1_1: (x: Int)Unit.
+Unspecified value parameter x.
m2_1_1()()
^
Test_2.scala:41: error: too many arguments for macro method m2_1_1: (x: Int)Unit
@@ -52,22 +59,27 @@ Test_2.scala:41: error: too many arguments for macro method m2_1_1: (x: Int)Unit
Test_2.scala:42: error: too many arguments for macro method m2_1_1: (x: Int)Unit
m2_1_1()(1, 2, 3)
^
-Test_2.scala:44: error: macro applications do not support named and/or default arguments
+Test_2.scala:44: error: not enough arguments for macro method m2_2_2: (x: Int, y: Int)Unit.
+Unspecified value parameters x, y.
m2_2_2()()
^
-Test_2.scala:45: error: macro applications do not support named and/or default arguments
+Test_2.scala:45: error: not enough arguments for macro method m2_2_2: (x: Int, y: Int)Unit.
+Unspecified value parameter y.
m2_2_2()(1)
^
Test_2.scala:47: error: too many arguments for macro method m2_2_2: (x: Int, y: Int)Unit
m2_2_2()(1, 2, 3)
^
-Test_2.scala:54: error: macro applications do not support named and/or default arguments
+Test_2.scala:54: error: not enough arguments for macro method m2_1_inf: (x: Int, y: Int*)Unit.
+Unspecified value parameters x, y.
m2_1_inf()()
^
-Test_2.scala:59: error: macro applications do not support named and/or default arguments
+Test_2.scala:59: error: not enough arguments for macro method m2_2_inf: (x: Int, y: Int, z: Int*)Unit.
+Unspecified value parameters x, y, z.
m2_2_inf()()
^
-Test_2.scala:60: error: macro applications do not support named and/or default arguments
+Test_2.scala:60: error: not enough arguments for macro method m2_2_inf: (x: Int, y: Int, z: Int*)Unit.
+Unspecified value parameters y, z.
m2_2_inf()(1)
^
24 errors found