[Issue 209] New: "Diamond" import name conflicts when using Fully Qualified names

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 19 07:38:19 PDT 2006


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

           Summary: "Diamond" import name conflicts when using Fully
                    Qualified names
           Product: D
           Version: 0.160
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: daiphoenix at lycos.com


In a "diamond-shaped" structure of imports, name conflicts occur on the bottom
module when accessing top module entities with a fully qualified name (because
the top module name itself conflicts). Example:

---- foo.d ----
module foo;

int fooEnt; // could a be a class, func, any other entity.

---- barA.d ----
module barA;

import foo;


---- barB.d ----
module barA;

import foo;


---- test.d ----

import barA;
import barB;

void main()
{
  fooEnt++;  // Compiles ok. (Correct)

  foo.fooEnt++;  // Compile error, name conflicts (INCORRECT) :
      // barA.d(3): import barA.foo conflicts with barB.foo at barB.d(3)

  alias foo xxx; // Compile error too, 
      // accessing the top module is enough to trigger it
} 


This bug does not happen if the "root name" (first name) of the top and middle
modules is the same, such as this:

---- mod.foo.d ----
module mod.foo;

int fooEnt; // could a be a class, func, any other entity.

---- mod.barA.d ----
module mod.barA;

import mod.foo;


---- mod.barB.d ----
module mod.barA;

import mod.foo;


---- test.d ----

import mod.barA;
import mod.barB;

void main()
{
  fooEnt++;  // Compiles ok. (Correct)

  mod.foo.fooEnt++;  // Compiles ok. (Correct)
}


-- 




More information about the Digitalmars-d-bugs mailing list