From b14d8f83d8194867f24aa823aa3a1ff9891f015a Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Mon, 8 Jan 2018 12:14:20 +0000 Subject: [PATCH 1/4] Fix Issue 16165 - Show count of arguments vs parameters on mismatch --- src/dmd/mtype.d | 16 +++++++++++ test/fail_compilation/diag8101.d | 47 ++++++++++++++++---------------- test/fail_compilation/diag9420.d | 3 +- test/fail_compilation/fail332.d | 45 ++++++++++++++++++++++++++++-- test/fail_compilation/fail99.d | 3 +- test/fail_compilation/ice10922.d | 3 +- test/fail_compilation/ice12501.d | 8 ++++-- test/fail_compilation/ice9540.d | 5 ++-- 8 files changed, 97 insertions(+), 33 deletions(-) diff --git a/src/dmd/mtype.d b/src/dmd/mtype.d index 2c5d7c3fd9f8..021f0755cd5b 100644 --- a/src/dmd/mtype.d +++ b/src/dmd/mtype.d @@ -4514,6 +4514,13 @@ extern (C++) final class TypeFunction : TypeNext return buf.extractString(); } + private const(char)* getMatchError(A...)(const(char)* format, A args) + { + OutBuffer buf; + buf.printf(format, args); + return buf.extractString(); + } + /******************************** * 'args' are being matched to function 'this' * Determine match level. @@ -4566,7 +4573,10 @@ extern (C++) final class TypeFunction : TypeNext else if (nargs > nparams) { if (varargs == 0) + { + if (pMessage) *pMessage = getMatchError("expected %d argument(s), not %d", nparams, nargs); goto Nomatch; + } // too many args; no match match = MATCH.convert; // match ... with a "conversion" match level } @@ -4733,7 +4743,11 @@ extern (C++) final class TypeFunction : TypeNext tsa = cast(TypeSArray)tb; sz = tsa.dim.toInteger(); if (sz != nargs - u) + { + if (pMessage) *pMessage = getMatchError("expected %d variadic argument(s), not %d", + sz, nargs - u); goto Nomatch; + } goto case Tarray; case Tarray: { @@ -4784,6 +4798,8 @@ extern (C++) final class TypeFunction : TypeNext } if (pMessage && u < nargs) *pMessage = getParamError((*args)[u], p); + else if (pMessage) + *pMessage = getMatchError("expected %d argument(s), not %d", nparams, nargs); goto Nomatch; } if (m < match) diff --git a/test/fail_compilation/diag8101.d b/test/fail_compilation/diag8101.d index 0f1f36410dbd..8f73c501bd3b 100644 --- a/test/fail_compilation/diag8101.d +++ b/test/fail_compilation/diag8101.d @@ -1,29 +1,30 @@ /* TEST_OUTPUT: --- -fail_compilation/diag8101.d(56): Error: function `diag8101.f_0(int)` is not callable using argument types `()` -fail_compilation/diag8101.d(57): Error: none of the overloads of `f_1` are callable using argument types `()`, candidates are: -fail_compilation/diag8101.d(32): `diag8101.f_1(int)` -fail_compilation/diag8101.d(33): `diag8101.f_1(int, int)` -fail_compilation/diag8101.d(58): Error: none of the overloads of `f_2` are callable using argument types `()`, candidates are: -fail_compilation/diag8101.d(35): `diag8101.f_2(int)` -fail_compilation/diag8101.d(36): `diag8101.f_2(int, int)` -fail_compilation/diag8101.d(37): `diag8101.f_2(int, int, int)` -fail_compilation/diag8101.d(38): `diag8101.f_2(int, int, int, int)` -fail_compilation/diag8101.d(39): `diag8101.f_2(int, int, int, int, int)` -fail_compilation/diag8101.d(58): ... (1 more, -v to show) ... -fail_compilation/diag8101.d(60): Error: template `diag8101.t_0` cannot deduce function from argument types `!()()`, candidates are: -fail_compilation/diag8101.d(42): `diag8101.t_0(T1)()` -fail_compilation/diag8101.d(61): Error: template `diag8101.t_1` cannot deduce function from argument types `!()()`, candidates are: -fail_compilation/diag8101.d(44): `diag8101.t_1(T1)()` -fail_compilation/diag8101.d(45): `diag8101.t_1(T1, T2)()` -fail_compilation/diag8101.d(62): Error: template `diag8101.t_2` cannot deduce function from argument types `!()()`, candidates are: -fail_compilation/diag8101.d(47): `diag8101.t_2(T1)()` -fail_compilation/diag8101.d(48): `diag8101.t_2(T1, T2)()` -fail_compilation/diag8101.d(49): `diag8101.t_2(T1, T2, T3)()` -fail_compilation/diag8101.d(50): `diag8101.t_2(T1, T2, T3, T4)()` -fail_compilation/diag8101.d(51): `diag8101.t_2(T1, T2, T3, T4, T5)()` -fail_compilation/diag8101.d(62): ... (1 more, -v to show) ... +fail_compilation/diag8101.d(57): Error: function `diag8101.f_0(int)` is not callable using argument types `()` +fail_compilation/diag8101.d(57): expected 1 argument(s), not 0 +fail_compilation/diag8101.d(58): Error: none of the overloads of `f_1` are callable using argument types `()`, candidates are: +fail_compilation/diag8101.d(33): `diag8101.f_1(int)` +fail_compilation/diag8101.d(34): `diag8101.f_1(int, int)` +fail_compilation/diag8101.d(59): Error: none of the overloads of `f_2` are callable using argument types `()`, candidates are: +fail_compilation/diag8101.d(36): `diag8101.f_2(int)` +fail_compilation/diag8101.d(37): `diag8101.f_2(int, int)` +fail_compilation/diag8101.d(38): `diag8101.f_2(int, int, int)` +fail_compilation/diag8101.d(39): `diag8101.f_2(int, int, int, int)` +fail_compilation/diag8101.d(40): `diag8101.f_2(int, int, int, int, int)` +fail_compilation/diag8101.d(59): ... (1 more, -v to show) ... +fail_compilation/diag8101.d(61): Error: template `diag8101.t_0` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/diag8101.d(43): `diag8101.t_0(T1)()` +fail_compilation/diag8101.d(62): Error: template `diag8101.t_1` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/diag8101.d(45): `diag8101.t_1(T1)()` +fail_compilation/diag8101.d(46): `diag8101.t_1(T1, T2)()` +fail_compilation/diag8101.d(63): Error: template `diag8101.t_2` cannot deduce function from argument types `!()()`, candidates are: +fail_compilation/diag8101.d(48): `diag8101.t_2(T1)()` +fail_compilation/diag8101.d(49): `diag8101.t_2(T1, T2)()` +fail_compilation/diag8101.d(50): `diag8101.t_2(T1, T2, T3)()` +fail_compilation/diag8101.d(51): `diag8101.t_2(T1, T2, T3, T4)()` +fail_compilation/diag8101.d(52): `diag8101.t_2(T1, T2, T3, T4, T5)()` +fail_compilation/diag8101.d(63): ... (1 more, -v to show) ... --- */ diff --git a/test/fail_compilation/diag9420.d b/test/fail_compilation/diag9420.d index cc71a606dd5f..a7b855733dd0 100644 --- a/test/fail_compilation/diag9420.d +++ b/test/fail_compilation/diag9420.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT --- -fail_compilation/diag9420.d(20): Error: function `diag9420.S.t3!().tx()` is not callable using argument types `(int)` +fail_compilation\diag9420.d(21): Error: function `diag9420.S.t3!().tx()` is not callable using argument types `(int)` +fail_compilation\diag9420.d(21): expected 0 argument(s), not 1 --- */ diff --git a/test/fail_compilation/fail332.d b/test/fail_compilation/fail332.d index 12db30979ab1..cf93e3dbd591 100644 --- a/test/fail_compilation/fail332.d +++ b/test/fail_compilation/fail332.d @@ -1,15 +1,56 @@ /* TEST_OUTPUT: --- -fail_compilation/fail332.d(14): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `()` +fail_compilation\fail332.d(32): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `()` +fail_compilation\fail332.d(32): expected 1 argument(s), not 0 +fail_compilation\fail332.d(33): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `(typeof(null))` +fail_compilation\fail332.d(33): cannot pass argument `null` of type `typeof(null)` to parameter `int _param_0` +fail_compilation\fail332.d(35): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(string)` +fail_compilation\fail332.d(35): cannot pass argument `""` of type `string` to parameter `int[] _param_0...` +fail_compilation\fail332.d(36): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(int, typeof(null))` +fail_compilation\fail332.d(36): cannot pass argument `null` of type `typeof(null)` to parameter `int[] _param_0...` --- */ import core.vararg; void foo(int, ...) {} +void baz(int[]...) {} -void bar() +void test() { foo(); + foo(null); + + baz(""); + baz(3, null); +} + +/* +TEST_OUTPUT: +--- +fail_compilation\fail332.d(50): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `()` +fail_compilation\fail332.d(50): expected 2 argument(s), not 0 +fail_compilation\fail332.d(51): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(int)` +fail_compilation\fail332.d(51): cannot pass argument `4` of type `int` to parameter `Object` +fail_compilation\fail332.d(52): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null))` +fail_compilation\fail332.d(52): expected 2 variadic argument(s), not 0 +fail_compilation\fail332.d(53): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int)` +fail_compilation\fail332.d(53): expected 2 variadic argument(s), not 1 +fail_compilation\fail332.d(54): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, string)` +fail_compilation\fail332.d(54): cannot pass argument `""` of type `string` to parameter `int[2]...` +fail_compilation\fail332.d(55): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, int, int)` +fail_compilation\fail332.d(55): expected 2 variadic argument(s), not 3 +--- +*/ +void bar(Object, int[2]...); + +void test2() +{ + bar(); + bar(4); + bar(null); + bar(null, 2); + bar(null, 2, ""); + bar(null, 2,3,4); } diff --git a/test/fail_compilation/fail99.d b/test/fail_compilation/fail99.d index 23cf81498e49..d11fd7389e06 100644 --- a/test/fail_compilation/fail99.d +++ b/test/fail_compilation/fail99.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail99.d(12): Error: delegate `dg(int)` is not callable using argument types `()` +fail_compilation/fail99.d(13): Error: delegate `dg(int)` is not callable using argument types `()` +fail_compilation/fail99.d(13): expected 1 argument(s), not 0 --- */ diff --git a/test/fail_compilation/ice10922.d b/test/fail_compilation/ice10922.d index a740d72207c9..9780ca961cd8 100644 --- a/test/fail_compilation/ice10922.d +++ b/test/fail_compilation/ice10922.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/ice10922.d(9): Error: function `ice10922.__lambda4(const(uint) n)` is not callable using argument types `()` +fail_compilation/ice10922.d(10): Error: function `ice10922.__lambda4(const(uint) n)` is not callable using argument types `()` +fail_compilation/ice10922.d(10): expected 1 argument(s), not 0 --- */ diff --git a/test/fail_compilation/ice12501.d b/test/fail_compilation/ice12501.d index 64e05a34d4d0..0f90aa133dfd 100644 --- a/test/fail_compilation/ice12501.d +++ b/test/fail_compilation/ice12501.d @@ -1,9 +1,11 @@ /* TEST_OUTPUT: --- -fail_compilation/ice12501.d(29): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` -fail_compilation/ice12501.d(29): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` -fail_compilation/ice12501.d(43): Error: template instance `ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[])` error instantiating +fail_compilation/ice12501.d(37): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` +fail_compilation/ice12501.d(37): expected 1 argument(s), not 2 +fail_compilation/ice12501.d(37): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` +fail_compilation/ice12501.d(37): expected 1 argument(s), not 2 +fail_compilation/ice12501.d(51): Error: template instance `ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[])` error instantiating --- */ diff --git a/test/fail_compilation/ice9540.d b/test/fail_compilation/ice9540.d index 7aca8bdc1ec0..7ec40a78eca4 100644 --- a/test/fail_compilation/ice9540.d +++ b/test/fail_compilation/ice9540.d @@ -1,8 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/ice9540.d(34): Error: function `ice9540.A.test.AddFront!(this, f).AddFront.dg(int _param_0)` is not callable using argument types `()` -fail_compilation/ice9540.d(25): Error: template instance `ice9540.A.test.AddFront!(this, f)` error instantiating +fail_compilation/ice9540.d(40): Error: function `ice9540.A.test.AddFront!(this, f).AddFront.dg(int _param_0)` is not callable using argument types `()` +fail_compilation/ice9540.d(40): expected 1 argument(s), not 0 +fail_compilation/ice9540.d(31): Error: template instance `ice9540.A.test.AddFront!(this, f)` error instantiating --- */ From 350b3c096be7aa4c63e98b597623e18638137320 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 19 Jan 2018 12:05:49 +0000 Subject: [PATCH 2/4] Add workaround for possible OutBuffer.vprintf issue on Windows (Vista) --- src/dmd/mtype.d | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dmd/mtype.d b/src/dmd/mtype.d index 021f0755cd5b..ff6046d20e75 100644 --- a/src/dmd/mtype.d +++ b/src/dmd/mtype.d @@ -4744,8 +4744,15 @@ extern (C++) final class TypeFunction : TypeNext sz = tsa.dim.toInteger(); if (sz != nargs - u) { - if (pMessage) *pMessage = getMatchError("expected %d variadic argument(s), not %d", - sz, nargs - u); + if (pMessage) + { + // Windows (Vista) OutBuffer.vprintf issue? 2nd argument always zero + //*pMessage = getMatchError("expected %d variadic argument(s), not %d", sz, nargs - u); + OutBuffer buf; + buf.printf("expected %d variadic argument(s)", sz); + buf.printf(", not %d", nargs - u); + *pMessage = buf.extractString(); + } goto Nomatch; } goto case Tarray; From 97a186690f1295a92e07554a35d8c147f4b089f7 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Tue, 6 Feb 2018 15:19:28 +0000 Subject: [PATCH 3/4] Type-check preceeding arguments even when there are surplus arguments This finds the first argument that fails to match. --- src/dmd/mtype.d | 19 ++++++++++++------- test/fail_compilation/bug16165.d | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 test/fail_compilation/bug16165.d diff --git a/src/dmd/mtype.d b/src/dmd/mtype.d index ff6046d20e75..4fe534fbd560 100644 --- a/src/dmd/mtype.d +++ b/src/dmd/mtype.d @@ -4567,15 +4567,14 @@ extern (C++) final class TypeFunction : TypeNext size_t nparams = Parameter.dim(parameters); size_t nargs = args ? args.dim : 0; - if (nparams == nargs) - { - } - else if (nargs > nparams) + if (nargs > nparams) { if (varargs == 0) { - if (pMessage) *pMessage = getMatchError("expected %d argument(s), not %d", nparams, nargs); - goto Nomatch; + // suppress early exit if an error message is wanted, + // so we can check any matching args are valid + if (!pMessage) + goto Nomatch; } // too many args; no match match = MATCH.convert; // match ... with a "conversion" match level @@ -4624,8 +4623,8 @@ extern (C++) final class TypeFunction : TypeNext { if (p.defaultArg) continue; - goto L1; // try typesafe variadics + goto L1; } { Expression arg = (*args)[u]; @@ -4814,6 +4813,12 @@ extern (C++) final class TypeFunction : TypeNext } Ldone: + if (pMessage && !varargs && nargs > nparams) + { + // all parameters had a match, but there are surplus args + *pMessage = getMatchError("expected %d argument(s), not %d", nparams, nargs); + goto Nomatch; + } //printf("match = %d\n", match); return match; diff --git a/test/fail_compilation/bug16165.d b/test/fail_compilation/bug16165.d new file mode 100644 index 000000000000..1818e0d68f6c --- /dev/null +++ b/test/fail_compilation/bug16165.d @@ -0,0 +1,18 @@ +void f(int x, Object y); + +void g() +{ + Object o; + f(o, o, 404); + f(5, 6, 404); +} + +/* +TEST_OUTPUT: +--- +fail_compilation/bug16165.d(6): Error: function `bug16165.f(int x, Object y)` is not callable using argument types `(Object, Object, int)` +fail_compilation/bug16165.d(6): cannot pass argument `o` of type `object.Object` to parameter `int x` +fail_compilation/bug16165.d(7): Error: function `bug16165.f(int x, Object y)` is not callable using argument types `(int, int, int)` +fail_compilation/bug16165.d(7): cannot pass argument `6` of type `int` to parameter `Object y` +--- + */ From bff6a03a016f675b5d6a9bd929949368286418b4 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 2 Feb 2018 11:56:45 +0000 Subject: [PATCH 4/4] Minor fixes Fix test line numbers, Windows backslash Show which parameter is missing an argument Don't allocate argument count mismatch string when errors gagged Mark getMatchError as private --- src/dmd/mtype.d | 10 +++++--- test/fail_compilation/diag8101.d | 2 +- test/fail_compilation/diag9420.d | 4 ++-- test/fail_compilation/fail332.d | 40 ++++++++++++++++---------------- test/fail_compilation/fail99.d | 2 +- test/fail_compilation/ice10922.d | 2 +- test/fail_compilation/ice12501.d | 10 ++++---- test/fail_compilation/ice9540.d | 6 ++--- 8 files changed, 40 insertions(+), 36 deletions(-) diff --git a/src/dmd/mtype.d b/src/dmd/mtype.d index 4fe534fbd560..1c782a35bffe 100644 --- a/src/dmd/mtype.d +++ b/src/dmd/mtype.d @@ -4514,8 +4514,10 @@ extern (C++) final class TypeFunction : TypeNext return buf.extractString(); } - private const(char)* getMatchError(A...)(const(char)* format, A args) + private extern(D) const(char)* getMatchError(A...)(const(char)* format, A args) { + if (global.gag && !global.params.showGaggedErrors) + return null; OutBuffer buf; buf.printf(format, args); return buf.extractString(); @@ -4744,9 +4746,10 @@ extern (C++) final class TypeFunction : TypeNext if (sz != nargs - u) { if (pMessage) - { // Windows (Vista) OutBuffer.vprintf issue? 2nd argument always zero //*pMessage = getMatchError("expected %d variadic argument(s), not %d", sz, nargs - u); + if (!global.gag || global.params.showGaggedErrors) + { OutBuffer buf; buf.printf("expected %d variadic argument(s)", sz); buf.printf(", not %d", nargs - u); @@ -4805,7 +4808,8 @@ extern (C++) final class TypeFunction : TypeNext if (pMessage && u < nargs) *pMessage = getParamError((*args)[u], p); else if (pMessage) - *pMessage = getMatchError("expected %d argument(s), not %d", nparams, nargs); + *pMessage = getMatchError("missing argument for parameter #%d: `%s`", + u + 1, parameterToChars(p, this, false)); goto Nomatch; } if (m < match) diff --git a/test/fail_compilation/diag8101.d b/test/fail_compilation/diag8101.d index 8f73c501bd3b..3b2401ad8cf5 100644 --- a/test/fail_compilation/diag8101.d +++ b/test/fail_compilation/diag8101.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/diag8101.d(57): Error: function `diag8101.f_0(int)` is not callable using argument types `()` -fail_compilation/diag8101.d(57): expected 1 argument(s), not 0 +fail_compilation/diag8101.d(57): missing argument for parameter #1: `int` fail_compilation/diag8101.d(58): Error: none of the overloads of `f_1` are callable using argument types `()`, candidates are: fail_compilation/diag8101.d(33): `diag8101.f_1(int)` fail_compilation/diag8101.d(34): `diag8101.f_1(int, int)` diff --git a/test/fail_compilation/diag9420.d b/test/fail_compilation/diag9420.d index a7b855733dd0..6b2577d910e3 100644 --- a/test/fail_compilation/diag9420.d +++ b/test/fail_compilation/diag9420.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT --- -fail_compilation\diag9420.d(21): Error: function `diag9420.S.t3!().tx()` is not callable using argument types `(int)` -fail_compilation\diag9420.d(21): expected 0 argument(s), not 1 +fail_compilation/diag9420.d(21): Error: function `diag9420.S.t3!().tx()` is not callable using argument types `(int)` +fail_compilation/diag9420.d(21): expected 0 argument(s), not 1 --- */ diff --git a/test/fail_compilation/fail332.d b/test/fail_compilation/fail332.d index cf93e3dbd591..12164b92e9ab 100644 --- a/test/fail_compilation/fail332.d +++ b/test/fail_compilation/fail332.d @@ -1,14 +1,14 @@ /* TEST_OUTPUT: --- -fail_compilation\fail332.d(32): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `()` -fail_compilation\fail332.d(32): expected 1 argument(s), not 0 -fail_compilation\fail332.d(33): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `(typeof(null))` -fail_compilation\fail332.d(33): cannot pass argument `null` of type `typeof(null)` to parameter `int _param_0` -fail_compilation\fail332.d(35): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(string)` -fail_compilation\fail332.d(35): cannot pass argument `""` of type `string` to parameter `int[] _param_0...` -fail_compilation\fail332.d(36): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(int, typeof(null))` -fail_compilation\fail332.d(36): cannot pass argument `null` of type `typeof(null)` to parameter `int[] _param_0...` +fail_compilation/fail332.d(22): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `()` +fail_compilation/fail332.d(22): missing argument for parameter #1: `int _param_0` +fail_compilation/fail332.d(23): Error: function `fail332.foo(int _param_0, ...)` is not callable using argument types `(typeof(null))` +fail_compilation/fail332.d(23): cannot pass argument `null` of type `typeof(null)` to parameter `int _param_0` +fail_compilation/fail332.d(25): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(string)` +fail_compilation/fail332.d(25): cannot pass argument `""` of type `string` to parameter `int[] _param_0...` +fail_compilation/fail332.d(26): Error: function `fail332.baz(int[] _param_0...)` is not callable using argument types `(int, typeof(null))` +fail_compilation/fail332.d(26): cannot pass argument `null` of type `typeof(null)` to parameter `int[] _param_0...` --- */ @@ -29,18 +29,18 @@ void test() /* TEST_OUTPUT: --- -fail_compilation\fail332.d(50): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `()` -fail_compilation\fail332.d(50): expected 2 argument(s), not 0 -fail_compilation\fail332.d(51): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(int)` -fail_compilation\fail332.d(51): cannot pass argument `4` of type `int` to parameter `Object` -fail_compilation\fail332.d(52): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null))` -fail_compilation\fail332.d(52): expected 2 variadic argument(s), not 0 -fail_compilation\fail332.d(53): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int)` -fail_compilation\fail332.d(53): expected 2 variadic argument(s), not 1 -fail_compilation\fail332.d(54): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, string)` -fail_compilation\fail332.d(54): cannot pass argument `""` of type `string` to parameter `int[2]...` -fail_compilation\fail332.d(55): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, int, int)` -fail_compilation\fail332.d(55): expected 2 variadic argument(s), not 3 +fail_compilation/fail332.d(50): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `()` +fail_compilation/fail332.d(50): missing argument for parameter #1: `Object` +fail_compilation/fail332.d(51): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(int)` +fail_compilation/fail332.d(51): cannot pass argument `4` of type `int` to parameter `Object` +fail_compilation/fail332.d(52): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null))` +fail_compilation/fail332.d(52): expected 2 variadic argument(s), not 0 +fail_compilation/fail332.d(53): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int)` +fail_compilation/fail332.d(53): expected 2 variadic argument(s), not 1 +fail_compilation/fail332.d(54): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, string)` +fail_compilation/fail332.d(54): cannot pass argument `""` of type `string` to parameter `int[2]...` +fail_compilation/fail332.d(55): Error: function `fail332.bar(Object, int[2]...)` is not callable using argument types `(typeof(null), int, int, int)` +fail_compilation/fail332.d(55): expected 2 variadic argument(s), not 3 --- */ void bar(Object, int[2]...); diff --git a/test/fail_compilation/fail99.d b/test/fail_compilation/fail99.d index d11fd7389e06..c147b810ee67 100644 --- a/test/fail_compilation/fail99.d +++ b/test/fail_compilation/fail99.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/fail99.d(13): Error: delegate `dg(int)` is not callable using argument types `()` -fail_compilation/fail99.d(13): expected 1 argument(s), not 0 +fail_compilation/fail99.d(13): missing argument for parameter #1: `int` --- */ diff --git a/test/fail_compilation/ice10922.d b/test/fail_compilation/ice10922.d index 9780ca961cd8..9eeb622300a4 100644 --- a/test/fail_compilation/ice10922.d +++ b/test/fail_compilation/ice10922.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/ice10922.d(10): Error: function `ice10922.__lambda4(const(uint) n)` is not callable using argument types `()` -fail_compilation/ice10922.d(10): expected 1 argument(s), not 0 +fail_compilation/ice10922.d(10): missing argument for parameter #1: `const(uint) n` --- */ diff --git a/test/fail_compilation/ice12501.d b/test/fail_compilation/ice12501.d index 0f90aa133dfd..2c45c8a359da 100644 --- a/test/fail_compilation/ice12501.d +++ b/test/fail_compilation/ice12501.d @@ -1,11 +1,11 @@ /* TEST_OUTPUT: --- -fail_compilation/ice12501.d(37): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` -fail_compilation/ice12501.d(37): expected 1 argument(s), not 2 -fail_compilation/ice12501.d(37): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` -fail_compilation/ice12501.d(37): expected 1 argument(s), not 2 -fail_compilation/ice12501.d(51): Error: template instance `ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[])` error instantiating +fail_compilation/ice12501.d(31): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` +fail_compilation/ice12501.d(31): expected 1 argument(s), not 2 +fail_compilation/ice12501.d(31): Error: function `ice12501.foo(int value)` is not callable using argument types `(int, int)` +fail_compilation/ice12501.d(31): expected 1 argument(s), not 2 +fail_compilation/ice12501.d(45): Error: template instance `ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[])` error instantiating --- */ diff --git a/test/fail_compilation/ice9540.d b/test/fail_compilation/ice9540.d index 7ec40a78eca4..f95cb974c79b 100644 --- a/test/fail_compilation/ice9540.d +++ b/test/fail_compilation/ice9540.d @@ -1,9 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/ice9540.d(40): Error: function `ice9540.A.test.AddFront!(this, f).AddFront.dg(int _param_0)` is not callable using argument types `()` -fail_compilation/ice9540.d(40): expected 1 argument(s), not 0 -fail_compilation/ice9540.d(31): Error: template instance `ice9540.A.test.AddFront!(this, f)` error instantiating +fail_compilation/ice9540.d(35): Error: function `ice9540.A.test.AddFront!(this, f).AddFront.dg(int _param_0)` is not callable using argument types `()` +fail_compilation/ice9540.d(35): missing argument for parameter #1: `int _param_0` +fail_compilation/ice9540.d(26): Error: template instance `ice9540.A.test.AddFront!(this, f)` error instantiating --- */