Skip to content

Commit

Permalink
do not merge - testing what triggers Win32_64 error
Browse files Browse the repository at this point in the history
  • Loading branch information
n8sh committed Nov 18, 2018
1 parent 0c81a2d commit c9caece
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
27 changes: 18 additions & 9 deletions std/range/primitives.d
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,8 @@ the first argument using the dot notation, `array.save` is
equivalent to `save(array)`. The function does not duplicate the
content of the array, it simply returns its argument.
*/
@property inout(T)[] save(T)(return scope inout(T)[] a) @safe pure nothrow @nogc
//@property inout(T)[] save(T)(return scope inout(T)[] a) @safe pure nothrow @nogc
@property T[] save(T)(T[] a) @safe pure nothrow @nogc
{
return a;
}
Expand All @@ -2213,7 +2214,8 @@ equivalent to `popFront(array)`. For $(GLOSSARY narrow strings),
`popFront` automatically advances to the next $(GLOSSARY code
point).
*/
void popFront(T)(scope ref inout(T)[] a) @safe pure nothrow @nogc
//void popFront(T)(scope ref inout(T)[] a) @safe pure nothrow @nogc
void popFront(T)(ref T[] a) @safe pure nothrow @nogc
if (!isNarrowString!(T[]) && !is(T[] == void[]))
{
assert(a.length, "Attempting to popFront() past the end of an array of " ~ T.stringof);
Expand All @@ -2236,7 +2238,8 @@ if (!isNarrowString!(T[]) && !is(T[] == void[]))
}

/// ditto
void popFront(C)(scope ref inout(C)[] str) @trusted pure nothrow
//void popFront(C)(scope ref inout(C)[] str) @trusted pure nothrow
void popFront(C)(ref C[] str) @trusted pure nothrow
if (isNarrowString!(C[]))
{
import std.algorithm.comparison : min;
Expand Down Expand Up @@ -2334,7 +2337,8 @@ the first argument using the dot notation, `array.popBack` is
equivalent to `popBack(array)`. For $(GLOSSARY narrow strings), $(D
popFront) automatically eliminates the last $(GLOSSARY code point).
*/
void popBack(T)(scope ref inout(T)[] a) @safe pure nothrow @nogc
//void popBack(T)(scope ref inout(T)[] a) @safe pure nothrow @nogc
void popBack(T)(ref T[] a) @safe pure nothrow @nogc
if (!isNarrowString!(T[]) && !is(T[] == void[]))
{
assert(a.length);
Expand All @@ -2357,7 +2361,8 @@ if (!isNarrowString!(T[]) && !is(T[] == void[]))
}

/// ditto
void popBack(T)(scope ref inout(T)[] a) @safe pure
//void popBack(T)(scope ref inout(T)[] a) @safe pure
void popBack(T)(ref T[] a) @safe pure
if (isNarrowString!(T[]))
{
import std.utf : strideBack;
Expand Down Expand Up @@ -2401,7 +2406,8 @@ equivalent to `front(array)`. For $(GLOSSARY narrow strings), $(D
front) automatically returns the first $(GLOSSARY code point) as _a $(D
dchar).
*/
@property ref inout(T) front(T)(return scope inout(T)[] a) @safe pure nothrow @nogc
//@property ref inout(T) front(T)(return scope inout(T)[] a) @safe pure nothrow @nogc
@property ref T front(T)(T[] a) @safe pure nothrow @nogc
if (!isNarrowString!(T[]) && !is(T[] == void[]))
{
assert(a.length, "Attempting to fetch the front of an empty array of " ~ T.stringof);
Expand Down Expand Up @@ -2430,7 +2436,8 @@ if (!isNarrowString!(T[]) && !is(T[] == void[]))
}

/// ditto
@property dchar front(T)(scope const(T)[] a) @safe pure
//@property dchar front(T)(scope const(T)[] a) @safe pure
@property dchar front(T)(T[] a) @safe pure
if (isNarrowString!(T[]))
{
import std.utf : decode;
Expand All @@ -2447,7 +2454,8 @@ equivalent to `back(array)`. For $(GLOSSARY narrow strings), $(D
back) automatically returns the last $(GLOSSARY code point) as _a $(D
dchar).
*/
@property ref inout(T) back(T)(return scope inout(T)[] a) @safe pure nothrow @nogc
//@property ref inout(T) back(T)(return scope inout(T)[] a) @safe pure nothrow @nogc
@property ref T back(T)(T[] a) @safe pure nothrow @nogc
if (!isNarrowString!(T[]) && !is(T[] == void[]))
{
assert(a.length, "Attempting to fetch the back of an empty array of " ~ T.stringof);
Expand All @@ -2474,7 +2482,8 @@ if (!isNarrowString!(T[]) && !is(T[] == void[]))

/// ditto
// Specialization for strings
@property dchar back(T)(scope const(T)[] a) @safe pure
//@property dchar back(T)(scope const(T)[] a) @safe pure
@property dchar back(T)(T[] a) @safe pure
if (isNarrowString!(T[]))
{
import std.utf : decode, strideBack;
Expand Down
30 changes: 15 additions & 15 deletions std/utf.d
Original file line number Diff line number Diff line change
Expand Up @@ -1065,14 +1065,14 @@ if (isSomeChar!C)
/// Whether or not to replace invalid UTF with $(LREF replacementDchar)
alias UseReplacementDchar = Flag!"useReplacementDchar";

// Reduce distinct instantiations of decodeImpl.
private template TypeForDecode(T)
{
static if (isDynamicArray!T && is(T : E[], E) && __traits(isArithmetic, E) && !is(E == shared))
alias TypeForDecode = const(Unqual!E)[];
else
alias TypeForDecode = T;
}
//// Reduce distinct instantiations of decodeImpl.
//private template TypeForDecode(T)
//{
// static if (isDynamicArray!T && is(T : E[], E) && __traits(isArithmetic, E) && !is(E == shared))
// alias TypeForDecode = const(Unqual!E)[];
// else
// alias TypeForDecode = T;
//}

/++
Decodes and returns the code point starting at `str[index]`. `index`
Expand Down Expand Up @@ -1112,7 +1112,7 @@ do
if (str[index] < codeUnitLimit!S)
return str[index++];
else
return decodeImpl!(true, useReplacementDchar)(cast(TypeForDecode!S) str, index);
return decodeImpl!(true, useReplacementDchar)(/*cast(TypeForDecode!S)*/ str, index);
}

/// ditto
Expand All @@ -1132,7 +1132,7 @@ do
if (str[index] < codeUnitLimit!S)
return str[index++];
else
return decodeImpl!(true, useReplacementDchar)(cast(TypeForDecode!S) str, index);
return decodeImpl!(true, useReplacementDchar)(/*cast(TypeForDecode!S)*/ str, index);
}

///
Expand Down Expand Up @@ -1209,7 +1209,7 @@ do
//is undesirable, since not all overloads of decodeImpl need it. So, it
//should be moved back into decodeImpl once bug# 8521 has been fixed.
enum canIndex = isRandomAccessRange!S && hasSlicing!S && hasLength!S;
immutable retval = decodeImpl!(canIndex, useReplacementDchar)(cast(TypeForDecode!S) str, numCodeUnits);
immutable retval = decodeImpl!(canIndex, useReplacementDchar)(/*cast(TypeForDecode!S)*/ str, numCodeUnits);

// The other range types were already popped by decodeImpl.
static if (isRandomAccessRange!S && hasSlicing!S && hasLength!S)
Expand Down Expand Up @@ -1242,7 +1242,7 @@ do
}
else
{
immutable retval = decodeImpl!(true, useReplacementDchar)(cast(TypeForDecode!S) str, numCodeUnits);
immutable retval = decodeImpl!(true, useReplacementDchar)(/*cast(TypeForDecode!S)*/ str, numCodeUnits);
str = str[numCodeUnits .. $];
return retval;
}
Expand Down Expand Up @@ -1316,7 +1316,7 @@ do
numCodeUnits = strideBack(str);
immutable newLength = str.length - numCodeUnits;
size_t index = newLength;
immutable retval = decodeImpl!(true, useReplacementDchar)(cast(TypeForDecode!S) str, index);
immutable retval = decodeImpl!(true, useReplacementDchar)(/*cast(TypeForDecode!S)*/ str, index);
str = str[0 .. newLength];
return retval;
}
Expand Down Expand Up @@ -1350,7 +1350,7 @@ do
static if (isRandomAccessRange!S)
{
size_t index = str.length - numCodeUnits;
immutable retval = decodeImpl!(true, useReplacementDchar)(cast(TypeForDecode!S) str, index);
immutable retval = decodeImpl!(true, useReplacementDchar)(/*cast(TypeForDecode!S)*/ str, index);
str.popBackExactly(numCodeUnits);
return retval;
}
Expand All @@ -1367,7 +1367,7 @@ do
const Char[] codePoint = codeUnits[0 .. numCodeUnits];
size_t index = 0;
immutable retval = decodeImpl!(true, useReplacementDchar)(
cast(TypeForDecode!(typeof(codePoint))) codePoint, index);
/*cast(TypeForDecode!(typeof(codePoint)))*/ codePoint, index);
str = tmp;
return retval;
}
Expand Down

0 comments on commit c9caece

Please sign in to comment.