www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21661] New: Can't use fully-qualified name of the current

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

          Issue ID: 21661
           Summary: Can't use fully-qualified name of the current module
                    inside an expression
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: boris2.9 gmail.com

Test:
-----
module pkg.pkg2.test;

enum x = 1;

pragma(msg, pkg.pkg2.test.stringof);
pragma(msg, pkg.pkg2.test.x.stringof);
-----

Output:
onlineapp.d(5): Error: undefined identifier pkg2 in package pkg, perhaps add
static import pkg.pkg2;
onlineapp.d(5):        while evaluating pragma(msg, package
pkg.pkg2.test.stringof)
onlineapp.d(6): Error: undefined identifier pkg2 in package pkg, perhaps add
static import pkg.pkg2;
onlineapp.d(6):        while evaluating pragma(msg, package
pkg.pkg2.test.x.stringof)


Program compiles fine when the module declaration is a single identifier.

--
Feb 24 2021