diff options
author | Adriaan Moors <adriaan@lightbend.com> | 2016-06-02 19:02:32 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan@lightbend.com> | 2016-06-02 19:02:32 -0700 |
commit | ae03df947043f0b9a93017ca5a0018b7350fdabb (patch) | |
tree | 619a309b3a1b92ba42539bd32c425328d8900e23 /test/files | |
parent | 5fffe799329713f90d9188497504fe130e5b5000 (diff) | |
parent | 40b42ae71779fb333259674b05f28de45219939d (diff) | |
download | scala-ae03df947043f0b9a93017ca5a0018b7350fdabb.tar.gz scala-ae03df947043f0b9a93017ca5a0018b7350fdabb.tar.bz2 scala-ae03df947043f0b9a93017ca5a0018b7350fdabb.zip |
Merge pull request #5147 from som-snytt/issue/8667-too-many-args
SI-8667 Improve too-many-args message
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/eta-expand-star.check | 4 | ||||
-rw-r--r-- | test/files/neg/macro-invalidusage-badargs.check | 4 | ||||
-rw-r--r-- | test/files/neg/multi-array.check | 4 | ||||
-rw-r--r-- | test/files/neg/protected-constructors.check | 9 | ||||
-rw-r--r-- | test/files/neg/t1112.check | 4 | ||||
-rw-r--r-- | test/files/neg/t1523.check | 4 | ||||
-rw-r--r-- | test/files/neg/t6920.check | 4 | ||||
-rw-r--r-- | test/files/neg/t7157.check | 48 | ||||
-rw-r--r-- | test/files/neg/t8006.check | 4 | ||||
-rw-r--r-- | test/files/neg/t8035-no-adapted-args.check | 4 | ||||
-rw-r--r-- | test/files/neg/t8667.check | 91 | ||||
-rw-r--r-- | test/files/neg/t8667.scala | 37 | ||||
-rw-r--r-- | test/files/neg/t876.check | 4 |
13 files changed, 176 insertions, 45 deletions
diff --git a/test/files/neg/eta-expand-star.check b/test/files/neg/eta-expand-star.check index 6765d504fc..eba1721014 100644 --- a/test/files/neg/eta-expand-star.check +++ b/test/files/neg/eta-expand-star.check @@ -1,4 +1,4 @@ -eta-expand-star.scala:6: error: too many arguments for method apply: (v1: Seq[T])Unit in trait Function1 +eta-expand-star.scala:6: error: too many arguments (2) for method apply: (v1: Seq[T])Unit in trait Function1 g(1, 2) - ^ + ^ one error found diff --git a/test/files/neg/macro-invalidusage-badargs.check b/test/files/neg/macro-invalidusage-badargs.check index 19ac6528d3..ee549c45cb 100644 --- a/test/files/neg/macro-invalidusage-badargs.check +++ b/test/files/neg/macro-invalidusage-badargs.check @@ -13,7 +13,7 @@ Macros_Test_2.scala:8: error: not enough arguments for macro method foo: (x: Int Unspecified value parameter x. foo() ^ -Macros_Test_2.scala:9: error: too many arguments for macro method foo: (x: Int)Int +Macros_Test_2.scala:9: error: too many arguments (2) for macro method foo: (x: Int)Int foo(4, 2) - ^ + ^ 5 errors found diff --git a/test/files/neg/multi-array.check b/test/files/neg/multi-array.check index 511caa126f..06ffdc9fbc 100644 --- a/test/files/neg/multi-array.check +++ b/test/files/neg/multi-array.check @@ -1,4 +1,4 @@ -multi-array.scala:7: error: too many arguments for constructor Array: (_length: Int)Array[T] +multi-array.scala:7: error: too many arguments (2) for constructor Array: (_length: Int)Array[T] val a: Array[Int] = new Array(10, 10) - ^ + ^ one error found diff --git a/test/files/neg/protected-constructors.check b/test/files/neg/protected-constructors.check index f44d7db9b9..0279f5815d 100644 --- a/test/files/neg/protected-constructors.check +++ b/test/files/neg/protected-constructors.check @@ -1,6 +1,6 @@ -protected-constructors.scala:17: error: too many arguments for constructor Foo1: ()dingus.Foo1 +protected-constructors.scala:17: error: no arguments allowed for nullary constructor Foo1: ()dingus.Foo1 val foo1 = new Foo1("abc") - ^ + ^ protected-constructors.scala:18: error: constructor Foo2 in class Foo2 cannot be accessed in object P Access to protected constructor Foo2 not permitted because enclosing object P in package hungus is not a subclass of @@ -19,4 +19,7 @@ protected-constructors.scala:15: error: class Foo3 in object Ding cannot be acce object Ding in package dingus where target is defined class Bar3 extends Ding.Foo3("abc") ^ -four errors found +protected-constructors.scala:15: error: no arguments allowed for nullary constructor Object: ()Object + class Bar3 extends Ding.Foo3("abc") + ^ +5 errors found diff --git a/test/files/neg/t1112.check b/test/files/neg/t1112.check index 5e3821b153..e6058bf176 100644 --- a/test/files/neg/t1112.check +++ b/test/files/neg/t1112.check @@ -1,4 +1,4 @@ -t1112.scala:12: error: too many arguments for method call: (p: Int)(f: => Test.this.Type1)Unit +t1112.scala:12: error: too many arguments (2) for method call: (p: Int)(f: => Test.this.Type1)Unit call(0,() => System.out.println("here we are")) - ^ + ^ one error found diff --git a/test/files/neg/t1523.check b/test/files/neg/t1523.check index d2489f2602..273d0f8cf7 100644 --- a/test/files/neg/t1523.check +++ b/test/files/neg/t1523.check @@ -1,4 +1,4 @@ -t1523.scala:4: error: too many arguments for method bug: (x: Any)Any +t1523.scala:4: error: 25 more arguments than can be applied to method bug: (x: Any)Any def go() = bug("a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a") - ^ + ^ one error found diff --git a/test/files/neg/t6920.check b/test/files/neg/t6920.check index ee4eafb83e..d10abff03c 100644 --- a/test/files/neg/t6920.check +++ b/test/files/neg/t6920.check @@ -1,6 +1,6 @@ -t6920.scala:9: error: too many arguments for method applyDynamicNamed: (values: Seq[(String, Any)])String +t6920.scala:9: error: too many arguments (2) for method applyDynamicNamed: (values: Seq[(String, Any)])String error after rewriting to CompilerError.this.test.applyDynamicNamed("crushTheCompiler")(scala.Tuple2("a", 1), scala.Tuple2("b", 2)) possible cause: maybe a wrong Dynamic method signature? test.crushTheCompiler(a = 1, b = 2) - ^ + ^ one error found diff --git a/test/files/neg/t7157.check b/test/files/neg/t7157.check index 3988460d4b..0b81394946 100644 --- a/test/files/neg/t7157.check +++ b/test/files/neg/t7157.check @@ -1,22 +1,22 @@ -Test_2.scala:5: error: too many arguments for macro method m1_0_0: ()Unit +Test_2.scala:5: error: no arguments allowed for nullary macro method m1_0_0: ()Unit m1_0_0(1) - ^ -Test_2.scala:6: error: too many arguments for macro method m1_0_0: ()Unit + ^ +Test_2.scala:6: error: no arguments allowed for nullary macro method m1_0_0: ()Unit m1_0_0(1, 2) - ^ -Test_2.scala:7: error: too many arguments for macro method m1_0_0: ()Unit + ^ +Test_2.scala:7: error: no arguments allowed for nullary macro method m1_0_0: ()Unit m1_0_0(1, 2, 3) - ^ + ^ 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 +Test_2.scala:11: error: too many arguments (2) for macro method m1_1_1: (x: Int)Unit m1_1_1(1, 2) - ^ -Test_2.scala:12: error: too many arguments for macro method m1_1_1: (x: Int)Unit + ^ +Test_2.scala:12: error: too many arguments (3) for macro method m1_1_1: (x: Int)Unit m1_1_1(1, 2, 3) - ^ + ^ 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() @@ -25,9 +25,9 @@ Test_2.scala:15: error: not enough arguments for macro method m1_2_2: (x: Int, y 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 +Test_2.scala:17: error: too many arguments (3) for macro method m1_2_2: (x: Int, y: Int)Unit m1_2_2(1, 2, 3) - ^ + ^ 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() @@ -40,25 +40,25 @@ Test_2.scala:30: error: not enough arguments for macro method m1_2_inf: (x: Int, Unspecified value parameters y, z. m1_2_inf(1) ^ -Test_2.scala:35: error: too many arguments for macro method m2_0_0: ()Unit +Test_2.scala:35: error: no arguments allowed for nullary macro method m2_0_0: ()Unit m2_0_0()(1) - ^ -Test_2.scala:36: error: too many arguments for macro method m2_0_0: ()Unit + ^ +Test_2.scala:36: error: no arguments allowed for nullary macro method m2_0_0: ()Unit m2_0_0()(1, 2) - ^ -Test_2.scala:37: error: too many arguments for macro method m2_0_0: ()Unit + ^ +Test_2.scala:37: error: no arguments allowed for nullary macro method m2_0_0: ()Unit m2_0_0()(1, 2, 3) - ^ + ^ 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 +Test_2.scala:41: error: too many arguments (2) for macro method m2_1_1: (x: Int)Unit m2_1_1()(1, 2) - ^ -Test_2.scala:42: error: too many arguments for macro method m2_1_1: (x: Int)Unit + ^ +Test_2.scala:42: error: too many arguments (3) for macro method m2_1_1: (x: Int)Unit m2_1_1()(1, 2, 3) - ^ + ^ 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()() @@ -67,9 +67,9 @@ Test_2.scala:45: error: not enough arguments for macro method m2_2_2: (x: Int, y 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 +Test_2.scala:47: error: too many arguments (3) for macro method m2_2_2: (x: Int, y: Int)Unit m2_2_2()(1, 2, 3) - ^ + ^ 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()() diff --git a/test/files/neg/t8006.check b/test/files/neg/t8006.check index fbac26e3ad..6152d0fba3 100644 --- a/test/files/neg/t8006.check +++ b/test/files/neg/t8006.check @@ -1,6 +1,6 @@ -t8006.scala:3: error: too many arguments for method applyDynamicNamed: (value: (String, Any))String +t8006.scala:3: error: too many arguments (2) for method applyDynamicNamed: (value: (String, Any))String error after rewriting to X.this.d.applyDynamicNamed("meth")(scala.Tuple2("value1", 10), scala.Tuple2("value2", 100)) possible cause: maybe a wrong Dynamic method signature? d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed - ^ + ^ one error found diff --git a/test/files/neg/t8035-no-adapted-args.check b/test/files/neg/t8035-no-adapted-args.check index 43637b2c1f..0115dddc91 100644 --- a/test/files/neg/t8035-no-adapted-args.check +++ b/test/files/neg/t8035-no-adapted-args.check @@ -4,9 +4,9 @@ t8035-no-adapted-args.scala:4: warning: No automatic adaptation here: use explic after adaptation: Test.f((1, 2, 3): (Int, Int, Int)) f(1, 2, 3) ^ -t8035-no-adapted-args.scala:4: error: too many arguments for method f: (x: (Int, Int, Int))Int +t8035-no-adapted-args.scala:4: error: too many arguments (3) for method f: (x: (Int, Int, Int))Int f(1, 2, 3) - ^ + ^ t8035-no-adapted-args.scala:5: warning: No automatic adaptation here: use explicit parentheses. signature: Test.f[T](x: T): Int given arguments: <none> diff --git a/test/files/neg/t8667.check b/test/files/neg/t8667.check new file mode 100644 index 0000000000..82451ee5d6 --- /dev/null +++ b/test/files/neg/t8667.check @@ -0,0 +1,91 @@ +t8667.scala:6: error: too many arguments (3) for constructor C: (a: Int, b: Int)C +Note that 'c' is not a parameter name of the invoked method. + def c2 = new C(a = 42, b = 17, c = 5) + ^ +t8667.scala:7: error: unknown parameter name: c + def c3 = new C(b = 42, a = 17, c = 5) + ^ +t8667.scala:7: error: too many arguments (3) for constructor C: (a: Int, b: Int)C + def c3 = new C(b = 42, a = 17, c = 5) + ^ +t8667.scala:8: error: positional after named argument. + def c4 = new C(b = 42, a = 17, 5) + ^ +t8667.scala:8: error: too many arguments (3) for constructor C: (a: Int, b: Int)C + def c4 = new C(b = 42, a = 17, 5) + ^ +t8667.scala:9: error: not found: value c + def c5 = new C(a = 42, c = 17) + ^ +t8667.scala:10: error: parameter 'b' is already specified at parameter position 2 +Note that 'c' is not a parameter name of the invoked method. + def c6 = new C(a = 42, c = 17, b = 5) + ^ +t8667.scala:10: error: too many arguments (3) for constructor C: (a: Int, b: Int)C +Note that 'c' is not a parameter name of the invoked method. + def c6 = new C(a = 42, c = 17, b = 5) + ^ +t8667.scala:11: error: parameter 'a' is already specified at parameter position 1 +Note that 'c' is not a parameter name of the invoked method. + def c7 = new C(c = 42, a = 17, b = 5) + ^ +t8667.scala:11: error: too many arguments (3) for constructor C: (a: Int, b: Int)C +Note that 'c' is not a parameter name of the invoked method. + def c7 = new C(c = 42, a = 17, b = 5) + ^ +t8667.scala:12: error: parameter 'b' is already specified at parameter position 2 + def c8 = new C(42, 17, b = 5) + ^ +t8667.scala:12: error: too many arguments (3) for constructor C: (a: Int, b: Int)C + def c8 = new C(42, 17, b = 5) + ^ +t8667.scala:13: error: parameter 'b' is already specified at parameter position 2 +Note that 'c' is not a parameter name of the invoked method. + def c9 = new C(a = 42, c = 17, d = 3, b = 5) + ^ +t8667.scala:13: error: too many arguments (4) for constructor C: (a: Int, b: Int)C +Note that 'c', 'd' are not parameter names of the invoked method. + def c9 = new C(a = 42, c = 17, d = 3, b = 5) + ^ +t8667.scala:14: error: too many arguments (4) for constructor C: (a: Int, b: Int)C +Note that 'd', 'c' are not parameter names of the invoked method. + def c0 = new C(42, 17, d = 3, c = 5) + ^ +t8667.scala:25: error: no arguments allowed for nullary method f0: ()Int + f0(1) + ^ +t8667.scala:26: error: too many arguments (2) for method f1: (i: Int)Int + f1(1, 2) + ^ +t8667.scala:27: error: too many arguments (3) for method f1: (i: Int)Int + f1(1, 2, 3) + ^ +t8667.scala:28: error: 3 more arguments than can be applied to method f1: (i: Int)Int + f1(1, 2, 3, 4) + ^ +t8667.scala:29: error: 3 more arguments than can be applied to method f1: (i: Int)Int +Note that 'j' is not a parameter name of the invoked method. + f1(1, j = 2, 3, 4) + ^ +t8667.scala:30: error: 3 more arguments than can be applied to method f1: (i: Int)Int +Note that 'j', 'k' are not parameter names of the invoked method. + f1(1, j = 2, k = 3, 4) + ^ +t8667.scala:31: error: parameter 'i' is already specified at parameter position 1 +Note that 'k' is not a parameter name of the invoked method. + f2(k = 1, i = 2, j = 3) + ^ +t8667.scala:31: error: too many arguments (3) for method f2: (i: Int, j: Int)Int +Note that 'k' is not a parameter name of the invoked method. + f2(k = 1, i = 2, j = 3) + ^ +t8667.scala:32: error: one more argument than can be applied to method f6: (i: Int, j: Int, k: Int, l: Int, m: Int, n: Int)Int + f6(1, 2, 3, 4, 5, 6, 7) + ^ +t8667.scala:33: error: 2 more arguments than can be applied to method f6: (i: Int, j: Int, k: Int, l: Int, m: Int, n: Int)Int + f6(1, 2, 3, 4, 5, 6, 7, 8) + ^ +t8667.scala:34: error: 15 arguments but expected 12 for method f12: (i: Int, j: Int, k: Int, l: Int, m: Int, n: Int, o: Int, p: Int, q: Int, r: Int, s: Int, t: Int)Int + f12(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) + ^ +26 errors found diff --git a/test/files/neg/t8667.scala b/test/files/neg/t8667.scala new file mode 100644 index 0000000000..d55582ca6b --- /dev/null +++ b/test/files/neg/t8667.scala @@ -0,0 +1,37 @@ + +class C(a: Int, b: Int) + +trait T { + def c1 = new C(a = 42, b = 17) + def c2 = new C(a = 42, b = 17, c = 5) + def c3 = new C(b = 42, a = 17, c = 5) + def c4 = new C(b = 42, a = 17, 5) + def c5 = new C(a = 42, c = 17) + def c6 = new C(a = 42, c = 17, b = 5) + def c7 = new C(c = 42, a = 17, b = 5) + def c8 = new C(42, 17, b = 5) + def c9 = new C(a = 42, c = 17, d = 3, b = 5) + def c0 = new C(42, 17, d = 3, c = 5) +} + +trait X { + def f0() = 42 + def f1(i: Int) = 42 + def f2(i: Int, j: Int) = 42 + def f6(i: Int, j: Int, k: Int, l: Int, m: Int, n: Int) = 42 + def f12(i: Int, j: Int, k: Int, l: Int, m: Int, n: Int, o: Int, p: Int, q: Int, r: Int, s: Int, t: Int) = 42 + + def g() = { + f0(1) + f1(1, 2) + f1(1, 2, 3) + f1(1, 2, 3, 4) + f1(1, j = 2, 3, 4) + f1(1, j = 2, k = 3, 4) + f2(k = 1, i = 2, j = 3) + f6(1, 2, 3, 4, 5, 6, 7) + f6(1, 2, 3, 4, 5, 6, 7, 8) + f12(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) + () + } +} diff --git a/test/files/neg/t876.check b/test/files/neg/t876.check index 04c5c8f22e..7df2e126a6 100644 --- a/test/files/neg/t876.check +++ b/test/files/neg/t876.check @@ -1,4 +1,4 @@ -t876.scala:25: error: too many arguments for method apply: (key: AssertionError.A)manager.B in class HashMap +t876.scala:25: error: too many arguments (2) for method apply: (key: AssertionError.A)manager.B in class HashMap assert(manager.map(A2) == List(manager.map(A2, A1))) - ^ + ^ one error found |