www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 433] New: A deprecated, same-named alias screws up resolution of imports

reply d-bugmail puremagic.com writes:

           Summary: A deprecated, same-named alias screws up resolution of
           Product: D
           Version: 0.169
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: smjg iname.com
OtherBugsDependingO 340

If one module imports another module and declares an alias of a symbol in it
with the same name, and then another module imports both and tries to use the
symbol, then under current DMD the code generally compiles without any import
conflict error.

The spec states that "Aliasing can be used to 'import' a symbol from an import
into the current scope", but ought to make clearer the fact that doing so
doesn't create import conflicts when both importer and importee are imported by
a third module.  Assuming that this is intended behaviour, which would make
most sense.

However, if the alias is deprecated, it stops working.  This situation is
likely to occur when something is moved from one module to another, but kept as
a deprecated alias in its old module.

----- dep_alias_1.d -----
private import dep_alias_2;

deprecated alias dep_alias_2.qwert qwert;
----- dep_alias_2.d -----
const int qwert = 42;
----- dep_alias_3.d -----
import dep_alias_1;
import dep_alias_2;
import std.stdio;

void main() {
D:\My Documents\Programming\D\Tests\dep_alias_3.d(6): alias dep_alias_1.qwert
is deprecated

Even though dep_alias_3 imports both dep_alias_1 and dep_alias_2, it ignores
dep_alias_2.qwert, which isn't deprecated at all.

If the imports in dep_alias_3.d are swapped, then the code compiles and runs
without error.

Oct 14 2006
parent d-bugmail puremagic.com writes:

bugzilla digitalmars.com changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

------- Comment #1 from bugzilla digitalmars.com  2006-11-25 03:53 -------
Fixed DMD 0.175

Nov 25 2006