[Issue 8564] New: Ambiguous renamed import is allowed
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Aug 20 03:32:48 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8564
Summary: Ambiguous renamed import is allowed
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: maxim at maxim-fomin.ru
--- Comment #0 from Maxim Fomin <maxim at maxim-fomin.ru> 2012-08-20 03:32:46 PDT ---
Currently dmd accepts renamed import with local name,
which hijacks current module name and creates ambiguity.
in foo2.d:
module foo2;
import std.stdio;
void bar()
{
writeln("foo2");
}
in foo1.d:
module foo1;
import foo1 = foo2; //#1 hijack
import std.stdio;
void bar()
{
writeln("foo1");
}
int x;
void main()
{
foo1.bar(); // #2 ambiguous call is accepted
writeln(foo1.x); // #3, Error: undefined identifier 'x'
}
I think either #1 should be prohibited or #2 result in
"ambiguous call" error. Also, #3 should compile, because
x is defined in foo1.d
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list