Bug 433 – A deprecated, same-named alias screws up resolution of imports

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-10-14T15:18:00Z
Last change time
2014-02-15T13:22:14Z
Keywords
rejects-valid, spec
Assigned to
bugzilla
Creator
smjg
Blocks
340

Comments

Comment #0 by smjg — 2006-10-14T15:18:19Z
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() { writefln(qwert); } ---------- 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.
Comment #1 by bugzilla — 2006-11-25T03:53:16Z
Fixed DMD 0.175