www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14684] New: Circular import cases "Must be imported as

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

          Issue ID: 14684
           Summary: Circular import cases "Must be imported as FileName"
                    error
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: sigurdbergsvela gmail.com

Created attachment 1527
  --> https://issues.dlang.org/attachment.cgi?id=1527&action=edit
Minimalistic example

I have a structure
src
|-> main.d
|-> RootClass.d
|-> MyPackage/
   |-> PackagedClass.d

If I add an import in *RootClass* to *myPackage.PackagedClass*, it's fine.
If I remove that import, and an import to *PackagedClass* to *RootClass*, it
fine.

But with both, I get an error form DMD saying:
"../src/RootClass.d(1): Error: module PackagedClass from file
../src/myPackage/PackagedClass.d must be imported with 'import PackagedClass;'"

I'v included a minimalistic example. While creating the example I noticed that
this issue did not appear if both *RootClass* and *PackagedClass* was in the
same directory/package.

--
Jun 11 2015