Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/dmd/dsymbol.d
Original file line number Diff line number Diff line change
Expand Up @@ -1357,9 +1357,15 @@ public:
/* If both s2 and s are overloadable (though we only
* need to check s once)
*/

if ((s2.isOverloadSet() || s2.isOverloadable()) && (a || s.isOverloadable()))
{
a = mergeOverloadSet(ident, a, s2);
if (symbolIsVisible(this, s2))
{
a = mergeOverloadSet(ident, a, s2);
}
if (!symbolIsVisible(this, s))
s = s2;
continue;
}
if (flags & IgnoreAmbiguous) // if return NULL on ambiguity
Expand Down
3 changes: 1 addition & 2 deletions src/dmd/func.d
Original file line number Diff line number Diff line change
Expand Up @@ -2341,6 +2341,7 @@ extern (D) int overloadApply(Dsymbol fstart, scope int delegate(Dsymbol) dg, Sco
Dsymbol next;
for (Dsymbol d = fstart; d; d = next)
{
import dmd.access : checkSymbolAccess;
if (auto od = d.isOverDeclaration())
{
if (od.hasOverloads)
Expand All @@ -2353,7 +2354,6 @@ extern (D) int overloadApply(Dsymbol fstart, scope int delegate(Dsymbol) dg, Sco
*/
if (sc)
{
import dmd.access : checkSymbolAccess;
if (checkSymbolAccess(sc, od))
{
if (int r = overloadApply(od.aliassym, dg, sc))
Expand Down Expand Up @@ -2393,7 +2393,6 @@ extern (D) int overloadApply(Dsymbol fstart, scope int delegate(Dsymbol) dg, Sco
{
if (sc)
{
import dmd.access : checkSymbolAccess;
if (checkSymbolAccess(sc, ad))
next = ad.toAlias();
}
Expand Down
11 changes: 11 additions & 0 deletions test/compilable/checkimports3.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
REQUIRED_ARGS: -transition=checkimports -de
*/
import imports.checkimports3a;
import imports.checkimports3b;
import imports.checkimports3c;

void test()
{
foo();
}
15 changes: 0 additions & 15 deletions test/fail_compilation/checkimports3.d

This file was deleted.

2 changes: 1 addition & 1 deletion test/fail_compilation/dip22e.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TEST_OUTPUT:
---
fail_compilation/dip22e.d(16): Deprecation: `imports.dip22d.foo` is not visible from module `dip22e`
fail_compilation/dip22e.d(16): Error: function `imports.dip22d.foo` is not accessible from module `dip22e`
fail_compilation/dip22e.d(17): Deprecation: local import search method found overloadset `dip22e.bar` (2 overloads) instead of function `imports.dip22e.bar`
fail_compilation/dip22e.d(17): Deprecation: local import search method found overloadset `dip22e.bar` (1 overloads) instead of function `imports.dip22e.bar`
---
*/

Expand Down
17 changes: 17 additions & 0 deletions test/fail_compilation/fail17625.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail17625.d(16): Deprecation: `b17625.boo` is not visible from module `fail17625`
fail_compilation/fail17625.d(16): Error: function `b17625.boo` is not accessible from module `fail17625`
---
*/

module fail17625;

import imports.a17625;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: You are importing the modules using imports.a17625 but then you declare the module name in the file to be a17625. I'm hoping to deprecate this via #7778

import imports.b17625;

void main()
{
boo();
}
3 changes: 3 additions & 0 deletions test/fail_compilation/imports/a17625.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module a17625;

private int boo() { return 69; }
3 changes: 3 additions & 0 deletions test/fail_compilation/imports/b17625.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module b17625;

private int boo() { return 45; }