Bug 140 – Conflicting identifiers between imported modules are reported in the wrong file

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-05-13T16:12:00Z
Last change time
2014-02-15T13:19:32Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
smjg

Comments

Comment #0 by smjg — 2006-05-13T16:12:43Z
If a module imports two modules, each of which defines the same identifier, and then tries to use it without specifying which one, then the error is reported as being in one of the imported modules. This is nonsense. ----- module0.d ----- import module1; import module2; void main() { func(); } ----- module1.d ----- module module1; void func() {} ----- module2.d ----- module module2; void func() {} ---------- module1.d(3): function module1.func conflicts with module2.func at module2.d(3) ---------- If two libraries happen to use the same identifier, then this isn't the fault of either library. The compiler shouldn't be claiming that it is. In fact, the error is in module0, where the identifier is used. And it's the author of module0 that needs to resolve the conflict by explicitly specifying module1.func or module2.func. With the current bad error message, it's an absolute nightmare to find where the conflict needs resolving. A suitable error message for this instance would be: ---------- module0.d(5): identifier func matches both module1.d(3): module1.func and module2.d(3): module2.func ---------- Of course, it may be an overloaded function in either or both of the modules. The line number reported for each match might as well be where the name is first defined. If the conflict is between three or more modules, then the message should be adjusted accordingly.
Comment #1 by thomas-dloop — 2006-05-21T15:15:16Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-05-13: > If a module imports two modules, each of which defines the same identifier, and > then tries to use it without specifying which one, then the error is reported > as being in one of the imported modules. This is nonsense. Added to DStress as http://dstress.kuehne.cn/nocompile/i/import_14_A.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEcNY53w+/yD4P9tIRAvdnAJ9QbNE/vxuG6IBmo+ma6qyHhLU5swCdHWYQ IZqbOhwRHSZHQ9qkTKE9CME= =o9D0 -----END PGP SIGNATURE-----
Comment #2 by smjg — 2006-05-22T05:33:04Z
// __DSTRESS_EFILE__ 17 EFILE?
Comment #3 by bugzilla — 2006-12-12T03:44:17Z
Works in DMD 0.176