Bug 8792 – std.algorithm.joiner doesn't return a proper forward range

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2012-10-09T20:25:00Z
Last change time
2012-10-14T08:28:15Z
Keywords
pull
Assigned to
nobody
Creator
hsteoh

Comments

Comment #0 by hsteoh — 2012-10-09T20:25:31Z
import std.algorithm; import std.range; import std.stdio; void main() { auto x = [[1],[2],[3]]; auto yy = x.joiner; assert(isForwardRange!(typeof(yy))); writeln(yy.save); writeln(yy); } The output is: [] [1, 2, 3] Which means that yy.save didn't save at all! This is a pretty major bug since it makes joiner unusable where the result needs to be a forward range.
Comment #1 by hsteoh — 2012-10-09T22:15:59Z
Found the bug: joiner.Result.save didn't copy 1 field over, so the saved range is defective. https://github.com/D-Programming-Language/phobos/pull/853
Comment #2 by github-bugzilla — 2012-10-13T14:26:38Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/0c4ebc2ce702ca6e06379d80e78efc9ccb050ced Fix issue 8792. std.algorithm.joiner(ror).Result.save fails to copy over _valid_current, resulting in a defective copy returned by .save. https://github.com/D-Programming-Language/phobos/commit/d215dabbe2c70e737556933e6820ae5b0bf9ab93 Add unittest for issue 8792. https://github.com/D-Programming-Language/phobos/commit/a3289101b1561fa6ab87c7d24b14d9839d4f028c Merge pull request #853 from quickfur/issue8792 Fix issue 8792
Comment #3 by github-bugzilla — 2012-10-14T08:28:15Z