D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19850 - double nested joiner .back falsely thinks the range is empty
Summary: double nested joiner .back falsely thinks the range is empty
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-05-06 16:55 UTC by FeepingCreature
Modified: 2019-05-07 13:04 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description FeepingCreature 2019-05-06 16:55:04 UTC
Consider the following code:

    auto outer = [[[0]]];
    auto result = outer.map!(
      middle => middle.map!(
        inner => inner.map!(
          i => 0
        )
      ).joiner
    ).joiner.back;

Expected: result == 0
Got: core.exception.AssertError@dmd-2.085.1/linux/bin64/../../src/phobos/std/algorithm/iteration.d(567): Attempting to fetch the back of an empty map.
Comment 1 FeepingCreature 2019-05-07 09:06:51 UTC
Shorter repro: [[[0]]].map!joiner.joiner.back;
Comment 2 Dlang Bot 2019-05-07 11:26:08 UTC
@Spoov created dlang/phobos pull request #6995 "Fix Issue 19850 - double nested joiner .back falsely thinks the range…" fixing this issue:

- Fix Issue 19850 - double nested joiner .back falsely thinks the range is empty

https://github.com/dlang/phobos/pull/6995
Comment 3 Dlang Bot 2019-05-07 13:04:36 UTC
dlang/phobos pull request #6995 "Fix Issue 19850 - double nested joiner .back falsely thinks the range…" was merged into stable:

- 46a35b902882df5abcd2320c410dab692366cce5 by Spoov:
  Fix Issue 19850 - double nested joiner .back falsely thinks the range is empty

https://github.com/dlang/phobos/pull/6995