www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12994] New: Function-local imported name shadowing error

https://issues.dlang.org/show_bug.cgi?id=12994

          Issue ID: 12994
           Summary: Function-local imported name shadowing error
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

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.

--
Jun 26 2014