Fix listing candidates when no overloads match from different modules

This commit is contained in:
Nick Treleaven 2024-09-04 15:19:30 +01:00 committed by Nicholas Wilson
parent 855521dd86
commit 913e9f537f
3 changed files with 8 additions and 3 deletions

View file

@ -1621,6 +1621,8 @@ FuncDeclaration resolveFuncCall(const ref Loc loc, Scope* sc, Dsymbol s,
{
.error(loc, "none of the overloads of `%s` are callable using argument types `!(%s)%s`",
od.ident.toChars(), tiargsBuf.peekChars(), fargsBuf.peekChars());
if (!global.gag || global.params.v.showGaggedErrors)
printCandidates(loc, od, sc.isDeprecated());
return null;
}
@ -1745,7 +1747,6 @@ FuncDeclaration resolveFuncCall(const ref Loc loc, Scope* sc, Dsymbol s,
* showDeprecated = If `false`, `deprecated` function won't be shown
*/
private void printCandidates(Decl)(const ref Loc loc, Decl declaration, bool showDeprecated)
if (is(Decl == TemplateDeclaration) || is(Decl == FuncDeclaration))
{
// max num of overloads to print (-v or -verror-supplements overrides this).
const uint DisplayLimit = global.params.v.errorSupplementCount();

View file

@ -2,7 +2,9 @@
EXTRA_FILES: imports/a18243.d
TEST_OUTPUT:
---
fail_compilation/fail18243.d(15): Error: none of the overloads of `isNaN` are callable using argument types `!()(float)`
fail_compilation/fail18243.d(17): Error: none of the overloads of `isNaN` are callable using argument types `!()(float)`
/home/nick/git/dmd/compiler/test/../../../phobos/std/math/traits.d(31): Candidates are: `isNaN(X)(X x)`
fail_compilation/imports/a18243.d(5): `a18243.isNaN()`
---
*/

View file

@ -2,7 +2,9 @@
EXTRA_FILES: imports/range15788.d
TEST_OUTPUT:
---
fail_compilation/ice15788.d(18): Error: none of the overloads of `iota` are callable using argument types `!()(S, S)`
fail_compilation/ice15788.d(20): Error: none of the overloads of `iota` are callable using argument types `!()(S, S)`
fail_compilation/imports/range15788.d(3): Candidates are: `iota(B, E, S)(B, E, S)`
fail_compilation/ice15788.d(13): `ice15788.iota()`
---
*/