www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11524] New: str.strip being shadowed by std.algorithm.strip

https://d.puremagic.com/issues/show_bug.cgi?id=11524

           Summary: str.strip being shadowed by std.algorithm.strip
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: hans fugal.net



import std.string;
import std.stdio;

// OK
unittest {
    string foo = " foo ";
    writeln(foo.strip);
}

/* Not OK

strip.d(21): Error: template std.algorithm.strip does not match any function
template declaration. Candidates are:
/usr/share/dmd/src/phobos/std/algorithm.d(7122):       
std.algorithm.strip(Range, E)(Range range, E element) if
(isBidirectionalRange!Range && is(typeof(range.front == element) : bool))
/usr/share/dmd/src/phobos/std/algorithm.d(7129):       
std.algorithm.strip(alias pred, Range)(Range range) if
(isBidirectionalRange!Range && is(typeof(pred(range.back)) : bool))
strip.d(21): Error: template std.algorithm.strip(Range, E)(Range range, E
element) if (isBidirectionalRange!Range && is(typeof(range.front == element) :
bool)) cannot deduce template function from argument types !()(string)

*/
unittest {
    import std.algorithm;
    string bar = " bar ";
    writeln(bar.strip);
}

/* if I move "import std.algorithm;" outside of the unittest, it works fine. */

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 15 2013