www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17091] New: std.range.zip cannot "save" correctly

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

          Issue ID: 17091
           Summary: std.range.zip cannot "save" correctly
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: enjouzensyou.boinc gmail.com

Following code cannot be done correctly.
I tested the following code on DMDv2.072.2.
The line of the 4th `writeln` should output "[Tuple!(int, int)(1, 4),
Tuple!(int, int)(2, 5), Tuple!(int, int)(3, 6)]".

----
import std.range;
import std.algorithm;
import std.stdio;

void main()
{
    auto s1 = [1, 2, 3].inputRangeObject;
    auto s2 = [4, 5, 6].inputRangeObject;

    writeln(s1.save);   // [1, 2, 3], OK
    writeln(s2.save);   // [1, 2, 3], OK

    auto added = s1.zip(s2);
    writeln(zs.save);   // [Tuple!(int, int)(1, 4), Tuple!(int, int)(2, 5),
Tuple!(int, int)(3, 6)], OK
    writeln(zs.save);   // [], NG
}
----

--
Jan 15 2017