aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2024-02-03 14:00:24 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2024-02-04 01:32:42 +0100
commitc428454ecee141937a6810dd6213716602d563ca (patch)
tree84ad8f3ba37eb09deee3c087f4fc5a93cc65d927 /libphobos/src/std
parent435bed3f028b21ccc2242c7ee8612d95f07b30dc (diff)
downloadgcc-c428454ecee141937a6810dd6213716602d563ca.zip
gcc-c428454ecee141937a6810dd6213716602d563ca.tar.gz
gcc-c428454ecee141937a6810dd6213716602d563ca.tar.bz2
d: Merge dmd, druntime a6f1083699, phobos 31dedd7da
D front-end changes: - Import dmd v2.107.0. - Character postfixes can now also be used for integers of size two or four. D run-time changes: - Import druntime v2.107.0. Phobos changes: - Import phobos v2.107.0. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd a6f1083699. * dmd/VERSION: Bump version to v2.107.0 * Make-lang.in (D_FRONTEND_OBJS): Add d/pragmasem.o. * d-builtins.cc (strip_type_modifiers): Update for new front-end interface. * d-codegen.cc (declaration_type): Likewise. (parameter_type): Likewise. * d-target.cc (TargetCPP::parameterType): Likewise. * expr.cc (ExprVisitor::visit (IndexExp *)): Likewise. (ExprVisitor::visit (VarExp *)): Likewise. (ExprVisitor::visit (AssocArrayLiteralExp *)): Likewise. * runtime.cc (get_libcall_type): Likewise. * typeinfo.cc (TypeInfoVisitor::visit (TypeInfoConstDeclaration *)): Likewise. (TypeInfoVisitor::visit (TypeInfoInvariantDeclaration *)): Likewise. (TypeInfoVisitor::visit (TypeInfoSharedDeclaration *)): Likewise. (TypeInfoVisitor::visit (TypeInfoWildDeclaration *)): Likewise. * types.cc (build_ctype): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime a6f1083699. * src/MERGE: Merge upstream phobos 31dedd7da.
Diffstat (limited to 'libphobos/src/std')
-rw-r--r--libphobos/src/std/algorithm/searching.d14
1 files changed, 12 insertions, 2 deletions
diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d
index 4526aa2..465723c 100644
--- a/libphobos/src/std/algorithm/searching.d
+++ b/libphobos/src/std/algorithm/searching.d
@@ -5053,7 +5053,8 @@ if (isInputRange!Range)
_input = input;
_sentinel = sentinel;
_openRight = openRight;
- static if (isInputRange!Sentinel)
+ static if (isInputRange!Sentinel
+ && is(immutable ElementEncodingType!Sentinel == immutable ElementEncodingType!Range))
{
_matchStarted = predSatisfied();
_done = _input.empty || _sentinel.empty || openRight && _matchStarted;
@@ -5120,7 +5121,8 @@ if (isInputRange!Range)
assert(!empty, "Can not popFront of an empty Until");
if (!_openRight)
{
- static if (isInputRange!Sentinel)
+ static if (isInputRange!Sentinel
+ && is(immutable ElementEncodingType!Sentinel == immutable ElementEncodingType!Range))
{
_input.popFront();
_done = _input.empty || _sentinel.empty;
@@ -5237,6 +5239,7 @@ pure @safe unittest
assert(equal(r.save, "foo"));
}
}
+
// https://issues.dlang.org/show_bug.cgi?id=14543
pure @safe unittest
{
@@ -5267,3 +5270,10 @@ pure @safe unittest
assert("one two three".until!((a,b)=>a.toUpper == b)("TWO", No.openRight).equal("one two"));
}
+// https://issues.dlang.org/show_bug.cgi?id=24342
+pure @safe unittest
+{
+ import std.algorithm.comparison : equal;
+ assert(["A", "BC", "D"].until("BC", No.openRight).equal(["A", "BC"]));
+ assert([[1], [2, 3], [4]].until([2, 3], No.openRight).equal([[1], [2, 3]]));
+}