Thread overview
[Issue 7122] New: [module] compiler fails to handle import of renamed module
Dec 17, 2011
dawg@dawgfoto.de
Dec 27, 2012
Andrej Mitrovic
Jan 08, 2013
Martin Nowak
Jan 08, 2013
Andrej Mitrovic
Jan 08, 2013
Martin Nowak
Jan 09, 2013
Andrej Mitrovic
Jan 09, 2013
Andrej Mitrovic
December 17, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7122

           Summary: [module] compiler fails to handle import of renamed
                    module
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dawg@dawgfoto.de


--- Comment #0 from dawg@dawgfoto.de 2011-12-16 21:19:16 PST ---
---- a0.d ----
module foo;
---- a1.d ----
module a1;
import a0;
--------------
dmd -lib a0.d a1.d
--------------
a1.d(2): Error: module foo from file a0.d conflicts with another module foo
from file a0.d
--------------

The compiler should detect this import as an already known module. This is important when splitting a module into declaration and definition when the defining file should be located in a path that doesn't match the module name.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7122


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |INVALID


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-27 08:57:53 PST ---
You can use whatever filename you want but you have to use the name in the module declaration when importing. See also Issue 4479

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7122



--- Comment #2 from Martin Nowak <code@dawg.eu> 2013-01-08 14:50:24 PST ---
Then per module compilation can't work.
dmd -c a1.d
How is the compiler able to know which file contains module a1?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7122



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-08 15:18:10 PST ---
(In reply to comment #2)
> Then per module compilation can't work.
> dmd -c a1.d

Works fine here.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7122



--- Comment #4 from Martin Nowak <code@dawg.eu> 2013-01-08 15:54:25 PST ---
>but you have to use the name in the
module declaration when importing

---
cat > a0.d << CODE
module foo;
CODE

cat > a1.d << CODE
import foo;
CODE

dmd -c a1.d
---
a1.d(1): Error: module foo is in file 'foo.d' which cannot be read
---

How is the compiler to know where to find the module foo?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7122



--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-08 16:45:42 PST ---
(In reply to comment #4)
> a1.d(1): Error: module foo is in file 'foo.d' which cannot be read

Right my bad, I used the wrong import. You can however use -c with multiple files as a workaround.

Walter will have to comment on this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7122



--- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-09 07:07:42 PST ---
Note that Walter recently confirmed the following is a bug: http://d.puremagic.com/issues/show_bug.cgi?id=9194

I can't find the NG post, but I filed that after he confirmed it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------