summaryrefslogtreecommitdiff
path: root/test/files/neg/t8667.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-05-04 15:52:01 -0700
committerSom Snytt <som.snytt@gmail.com>2016-05-13 08:36:01 -0700
commita6d5eb507bbeac2055a224a15fd76e7f9425520b (patch)
tree9ef73469b5a29d85be211502f8328dc5fdb97155 /test/files/neg/t8667.scala
parent9e30bee0c9363f6cf36a7b65ddbaaa225b57d6a9 (diff)
downloadscala-a6d5eb507bbeac2055a224a15fd76e7f9425520b.tar.gz
scala-a6d5eb507bbeac2055a224a15fd76e7f9425520b.tar.bz2
scala-a6d5eb507bbeac2055a224a15fd76e7f9425520b.zip
SI-8667 Improve too-many-args message
Use removeNames to help diagnose the application. Supplement the error message with how many extra args and any other residual assignments that the user might have thought was a properly named arg. The error message is gradual: succinct for short arg lists, more verbose for longer applications. Very long arg lists are probably generated, so that message is the least colloquial.
Diffstat (limited to 'test/files/neg/t8667.scala')
-rw-r--r--test/files/neg/t8667.scala35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/files/neg/t8667.scala b/test/files/neg/t8667.scala
new file mode 100644
index 0000000000..fe17eac84f
--- /dev/null
+++ b/test/files/neg/t8667.scala
@@ -0,0 +1,35 @@
+
+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(42, 17, c = 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 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)
+ 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)
+ ()
+ }
+}