Skip to content

Commit 75372ef

Browse files
Fix issue 24064: use consistent types for ResultRanges. (#8791)
`source` is `Unqual!Ranges`, not `Ranges`.
1 parent 153d33a commit 75372ef

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

std/range/package.d

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ if (Ranges.length > 0 &&
13841384
// force staticMap type conversion to Rebindable
13851385
static struct ResultRanges
13861386
{
1387-
staticMap!(Rebindable, Ranges) fields;
1387+
staticMap!(Rebindable, typeof(source)) fields;
13881388
}
13891389
auto sourceI(size_t i)() => rebindable(this.source[i]);
13901390
auto resultRanges = ResultRanges(staticMap!(sourceI, aliasSeqOf!(R.length.iota))).fields;
@@ -1672,6 +1672,17 @@ pure @safe unittest
16721672
assert(range.array == [S(5), S(6)]);
16731673
}
16741674

1675+
/// https://issues.dlang.org/show_bug.cgi?id=24064
1676+
pure @safe nothrow unittest
1677+
{
1678+
import std.algorithm.comparison : equal;
1679+
import std.typecons : Nullable;
1680+
1681+
immutable Nullable!string foo = "b";
1682+
string[] bar = ["a"];
1683+
assert(chain(bar, foo).equal(["a", "b"]));
1684+
}
1685+
16751686
pure @safe nothrow @nogc unittest
16761687
{
16771688
// support non-copyable items

0 commit comments

Comments
 (0)