Merge pull request #7089 from burner/std.algorithm.searching_assert_messages

Adds asserts messages
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2019-06-26 15:05:07 +02:00 committed by GitHub
commit 9fb63a5592
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -848,7 +848,8 @@ if (isForwardRange!R
} }
//Because of @@@8804@@@: Avoids both "unreachable code" or "no return statement" //Because of @@@8804@@@: Avoids both "unreachable code" or "no return statement"
static if (isInfinite!R) assert(0); static if (isInfinite!R) assert(false, R.stringof ~ " must not be an"
~ " infinite range");
else return -1; else return -1;
} }
@ -951,7 +952,8 @@ if (isInputRange!R &&
} }
//Because of @@@8804@@@: Avoids both "unreachable code" or "no return statement" //Because of @@@8804@@@: Avoids both "unreachable code" or "no return statement"
static if (isInfinite!R) assert(0); static if (isInfinite!R) assert(false, R.stringof ~ " must not be an"
~ " inifite range");
else return -1; else return -1;
} }
@ -2221,7 +2223,7 @@ private R1 simpleMindedFind(alias pred, R1, R2)(R1 haystack, scope R2 needle)
} }
else else
{ {
assert(haystack.empty); assert(haystack.empty, "Haystack must be empty by now");
return haystack; return haystack;
} }
} }
@ -5001,7 +5003,7 @@ if (isInputRange!Range)
/// ///
@property auto ref front() @property auto ref front()
{ {
assert(!empty); assert(!empty, "Can not get the front of an empty Until");
return _input.front; return _input.front;
} }
@ -5016,7 +5018,7 @@ if (isInputRange!Range)
/// ///
void popFront() void popFront()
{ {
assert(!empty); assert(!empty, "Can not popFront of an empty Until");
if (!_openRight) if (!_openRight)
{ {
_done = predSatisfied(); _done = predSatisfied();