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

Duplicate error messages when trying to use an inaccessible package symbol #19515

Open
dlangBugzillaToGithub opened this issue Dec 9, 2018 · 3 comments

Comments

@dlangBugzillaToGithub
Copy link

Mike Franklin reported this on 2018-12-09T22:35:25Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=19471

Description

// file c/b.d
module c.b;

public void aPublicFunction() {}

package void aPackageFunction() {}

// file a.d
module a;

public import c.b;

// file main.d
import a;

void main()
{
    aPublicFunction();
    aPrivateFunction();
}

dmd main.d a.d c/b.d

main.d(7): Deprecation: c.b.aPackageFunction is not visible from module main
main.d(7): Error: function c.b.aPackageFunction is not accessible from module main

The compiler emits 2 messages instead of just 1.
@dlangBugzillaToGithub
Copy link
Author

slavo5150 commented on 2018-12-10T03:36:18Z

The example in the previous comment was supposed to be:

// file c/b.d
module c.b;

public void aPublicFunction() {}

package void aPackageFunction() {}

// file a.d
module a;

public import c.b;

// file main.d
import a;

void main()
{
    aPublicFunction();
    aPackageFunction();   // Typo:  Private instead of Package
}

Anyway, this works fine if compiling with `-transition=import`.  I don't know

@dlangBugzillaToGithub
Copy link
Author

slavo5150 commented on 2018-12-10T03:38:37Z

`-transtion=import` was implemented with the fix for issue 10378.

I don't know if the compiler is transitioning to the behavior of the current compiler implementation, or transitioning away from the current implementation to the behavior in `-transition=import`.

@dlangBugzillaToGithub
Copy link
Author

slavo5150 commented on 2018-12-10T07:57:05Z

This should be resolved whenever the visibility and lookup deprecations are removed.

https://github.com/dlang/dmd/pull/9058
https://github.com/dlang/dmd/pull/7241

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

No branches or pull requests

1 participant