Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes protected and package cause imports to be public in certain cases. #20631

Open
Reavershark opened this issue Jan 2, 2025 · 0 comments

Comments

@Reavershark
Copy link

--- main.d
module main;

void scope1()
{
    import pkg.regular_imports : a; // Error: not found
    import pkg.regular_imports : b;
    import pkg.regular_imports : c;
    import pkg.regular_imports : d;
    import pkg.regular_imports : e;
}

void scope2()
{
    import pkg.selective_imports : a; // Error: invisible
    import pkg.selective_imports : b; // Error: invisible
    import pkg.selective_imports : c; // Error: invisible
    import pkg.selective_imports : d;
    import pkg.selective_imports : e;
}

void main() {}

--- pkg/regular_imports.d
module pkg.regular_imports;
private import pkg.a;
protected import pkg.b;
package import pkg.c;
public import pkg.d;
export import pkg.e;

--- pkg/selective_imports.d
module pkg.selective_imports;
private import pkg.a : a;
protected import pkg.b : b;
package import pkg.c : c;
public import pkg.d : d;
export import pkg.e : e;

--- pkg/a.d
module pkg.a;
int a;
--- pkg/b.d
module pkg.b;
int b;
--- pkg/c.d
module pkg.c;
int c;
--- pkg/d.d
module pkg.d;
int d;
--- pkg/e.d
module pkg.e;
int e;

Doesn't apply to selective imports.
Doesn't happen when modules a..e exist at the top level, not part of any package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant