D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19471 - Duplicate error messages when trying to use an inaccessible package symbol
Summary: Duplicate error messages when trying to use an inaccessible package symbol
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-09 22:35 UTC by Mike Franklin
Modified: 2024-12-13 19:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Mike Franklin 2018-12-09 22:35:25 UTC
// 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.
Comment 1 Mike Franklin 2018-12-10 03:36:18 UTC
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
Comment 2 Mike Franklin 2018-12-10 03:38:37 UTC
`-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`.
Comment 3 Mike Franklin 2018-12-10 07:57:05 UTC
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
Comment 4 dlangBugzillaToGithub 2024-12-13 19:01:33 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19515

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB