[Issue 282] New: Bizarre circular import nested name invisibility issue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 10 20:43:18 PDT 2006


http://d.puremagic.com/issues/show_bug.cgi?id=282

           Summary: Bizarre circular import nested name invisibility issue
           Product: D
           Version: 0.163
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: jarrett.billingsley at gmail.com


I really don't know what else to call this, and it's a bit tedious to get to
happen.  So here's the general idea:

------ [modules/test1.d] --------

module modules.test1;
import modules.test2;

struct A
{
        enum B
        {
                One,
                Two
        }
}

void bar()
{
        foo();
}

--------- [modules/test2.d] ---------

module modules.test2;
import modules.test1;

A.B foobar; // error, no property B for type A?!

void foo()
{
        int x;

        if(x == A.B.One) // but this is OK
                x = 1;
}

---------------------------------

Some interesting facts:

- This only seems to happen if the modules are in a package.  If they're two
top-level modules, it works fine.

- Notice I can't use A.B as a type, but I can in fact access A.B's members.

- Using static imports/aliased imports does not help.

I don't know how to get it to not work the way it does in MiniD - that is, I
can't even use A.B in the same module that A.B is defined!

This is, for me, something of a showstopper.. I'll probably be using 0.162 for
a bit, which is sad, considering how cool the 0.163 features are!  I don't know
if I should change the priority of this bug, but this is something that can't
be worked around easily, so I'd put it pretty high up there.


-- 




More information about the Digitalmars-d-bugs mailing list