Skip to content

Commit

Permalink
Fix issue 13535 byCodeUnit doesn't satisfy hasSlicing
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkuu committed Sep 27, 2014
1 parent 21c9db5 commit 2395bea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion std/utf.d
Expand Up @@ -2725,7 +2725,7 @@ auto byCodeUnit(R)(R r) if (isNarrowString!R)

auto opSlice(size_t lower, size_t upper)
{
return r[lower..upper];
return ByCodeUnitImpl(r[lower..upper]);
}

@property size_t length() const
Expand Down Expand Up @@ -2806,6 +2806,7 @@ pure nothrow @nogc unittest
}
{
auto r = "hello".byCodeUnit();
static assert(hasSlicing!(typeof(r)));
static assert(isBidirectionalRange!(typeof(r)));
auto ret = r.retro;
assert(ret.front == 'o');
Expand All @@ -2814,6 +2815,7 @@ pure nothrow @nogc unittest
}
{
auto r = "κόσμε"w.byCodeUnit();
static assert(hasSlicing!(typeof(r)));
static assert(isBidirectionalRange!(typeof(r)));
auto ret = r.retro;
assert(ret.front == 'ε');
Expand Down

0 comments on commit 2395bea

Please sign in to comment.