www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17950] New: cannot declare package internal symbol in package

https://issues.dlang.org/show_bug.cgi?id=17950

          Issue ID: 17950
           Summary: cannot declare package internal symbol in package
                    module
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

mkdir -p pkg
cat > pkg/package.d << CODE
module pkg;
package(pkg) int sym;
CODE
dmd -c -o- pkg/package.d
----
pkg/package.d(2): Error: protection attribute 'package(pkg)' does not bind to
one of ancestor packages of module pkg
----

The ancestor test should be made aware of package modules.

We could consider to change the default meaning of `package` (w/o qualified
name) in a package module, to mean exactly the current package, but could also
keep the current implementation to mean the ancestor package and only allow to
use the current package with a qualified name.

--
Oct 29 2017