Bug 12994 – Function-local imported name shadowing error

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-06-26T08:47:14Z
Last change time
2022-09-05T17:42:10Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-06-26T08:47:14Z
This is an enhancement request, but it's borderline being a bug report for the module system. Two similar examples: void main() { int map; import std.algorithm; map!(x => x)([1]); } void main() { int map; import std.algorithm: map; map!(x => x)([1]); } In both cases dmd 2.066alpha gives: test.d(4,8): Error: no property 'map' for type 'int[]' test.d(5,5): Error: template instance map!((x) => x) map is not a template declaration, it is a variable In both programs I expect something like a "'map' identifier shadowing error". An explicit "import std.algorithm: map;" getting totally ignored is not acceptable, in my opinion.
Comment #1 by wyatt.epp — 2016-02-26T17:09:40Z
Since 2.071 seems to be The Module System release (finally fixing Issue 313, Issue 314 (hopefully), and Issue 10378), maybe this should be addressed as well?
Comment #2 by nick — 2022-09-05T17:42:10Z
Either now gives: mapconflict.d(4): Error: template instance `map!((x) => x)` `map` is not a template declaration, it is a variable