digitalmars.D.bugs - [Issue 12598] New: Poor diagnostic with local import hijacking
- via Digitalmars-d-bugs (40/40) Apr 19 2014 https://issues.dlang.org/show_bug.cgi?id=12598
https://issues.dlang.org/show_bug.cgi?id=12598 Issue ID: 12598 Summary: Poor diagnostic with local import hijacking Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: diagnostic Severity: enhancement Priority: P3 Component: DMD Assignee: nobody puremagic.com Reporter: thecybershadow gmail.com Consider the following program: //////////////////// test.d //////////////////// class C { void addLine(string l) { debug { import std.stdio; stderr.writeln("Adding line: " ~ l); } lines ~= l; } immutable(string)[] lines; } //////////////////////////////////////////////// When compiled with -debug, the compiler produces the following error message: test.d(10,3): Error: lines is not an lvalue This error message is misleading - it's not clear that a symbol from std.stdio is hijacking the "lines" field. One way to improve the situation is to print fully-qualified symbol names in error messages. Another would be to add a warning or error when a locally-imported symbol is hijacking a non-global symbol. The user can silence this message by using a selective, static or named import. --
Apr 19 2014