D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20796 - protection attribute package(x.y) does not bind to one of ancestor packages of module x.y when declared in x/y/package.d
Summary: protection attribute package(x.y) does not bind to one of ancestor packages o...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: pull
: 17950 (view as issue list)
Depends on:
Blocks:
 
Reported: 2020-05-05 03:26 UTC by Nicholas Wilson
Modified: 2022-09-29 13:57 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nicholas Wilson 2020-05-05 03:26:38 UTC
file x/y/package.d:

module x.y;
package(x.y) void foo();

results in 

x/y/package.d(2): Error: protection attribute package(x.y) does not bind to one of ancestor packages of module x.y

which is patently false. 

In particular this makes it very annoying to convert a large module, say x.y, into a package and convert all private protection symbols to package(x.y) symbols when moving symbols from x.y to x.y.a.
Comment 1 Dlang Bot 2020-05-05 04:33:27 UTC
@thewilsonator created dlang/dmd pull request #11100 "Fix issue 20796: package protected symbol declared in the same packag…" fixing this issue:

- Fix issue 20796: package protected symbol declared in the same package.d don't work

https://github.com/dlang/dmd/pull/11100
Comment 2 Dlang Bot 2020-05-05 10:19:38 UTC
dlang/dmd pull request #11100 "Fix issue 20796: package protected symbol declared in the same packag…" was merged into master:

- 5cbd942fcd1939bb2c688e3efdfc8b89f1d4336b by Nicholas Lindsay Wilson:
  Fix issue 20796: package protected symbol declared in the same package.d don't work

https://github.com/dlang/dmd/pull/11100
Comment 3 Dennis 2022-09-29 13:57:38 UTC
*** Issue 17950 has been marked as a duplicate of this issue. ***