Bug 11065 – Package-scoped import introduces symbol conflicts

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-18T14:48:25Z
Last change time
2024-12-13T18:11:38Z
Assigned to
No Owner
Creator
Andrej Mitrovic
Moved to GitHub: dmd#18673 →

Comments

Comment #0 by andrej.mitrovich — 2013-09-18T14:48:25Z
test.d: ----- module test; import foo; import bar; void main() { auto x = RGB(0, 0, 255); } ----- foo.d: ----- module foo; struct RGB { ubyte r; ubyte g; ubyte b; } ----- bar.d: ----- module bar; package: import core.sys.windows.windows; ----- $ dmd -c test.d test.d(8): Error: foo.RGB at foo.d(4) conflicts with core.sys.windows.win dows.RGB at C:\dmd-git\dmd2\windows\bin\..\..\src\druntime\import\core\sy s\windows\windows.d(3213) If you remove the "package:" specifier, the error is gone. It's also unrelated to whether these modules are actually part of any package structure (the test-case is kept simple here). This does not appear to be a regression (tested up to 2.060).
Comment #1 by andrej.mitrovich — 2013-09-18T14:49:15Z
Also this test-case is Windows-specific due to the windows import from druntime, I should have removed the dependency in the test-case..
Comment #2 by andrej.mitrovich — 2013-09-18T14:50:51Z
Here's the new test-case without the win32 dependency: test.d: ----- module test; import foo; import bar; void main() { auto x = RGB(0, 0, 255); } ----- foo.d: ----- module foo; struct RGB { ubyte r, g, b; } ----- bar.d: ----- module bar; package: import doo; ----- doo.d: ----- struct RGB { ubyte r, g, b; } -----
Comment #3 by andrej.mitrovich — 2013-09-18T15:03:20Z
The problem of course is that "package" has no real meaning for imports, and should therefore be ignored. In other words, this: ---- package: import abcd; ---- Should not mark the import as a package import (this has no meaning in the spec), it should stay as a private import unless typed differently, e.g.: ---- package: import abcd; // private import void foo() { } // package function ----
Comment #4 by robert.schadek — 2024-12-13T18:11:38Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18673 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB