diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-11-12 14:21:43 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-11-21 14:29:28 +0100 |
commit | 87b9a01ea79a3af39f3adf7b60aa9526a32de17e (patch) | |
tree | 3a06e800632f8bd8ad391f0bffe2419ae8da5e15 /libphobos | |
parent | da332ce109451c8965cb64847934da154d7dcf94 (diff) | |
download | gcc-87b9a01ea79a3af39f3adf7b60aa9526a32de17e.zip gcc-87b9a01ea79a3af39f3adf7b60aa9526a32de17e.tar.gz gcc-87b9a01ea79a3af39f3adf7b60aa9526a32de17e.tar.bz2 |
d: Merge upstream dmd 65a3da148c, phobos fc06c514a.
D front-end changes:
- Import latest bug fixes from dmd v2.106.0-beta.1.
Phobos changes:
- Import latest bug fixes from phobos v2.106.0-beta.1.
- `std.range.primitives.isForwardRange' now takes an optional
element type.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 65a3da148c.
libphobos/ChangeLog:
* src/MERGE: Merge upstream phobos fc06c514a.
Diffstat (limited to 'libphobos')
-rw-r--r-- | libphobos/src/MERGE | 2 | ||||
-rw-r--r-- | libphobos/src/std/container/array.d | 11 | ||||
-rw-r--r-- | libphobos/src/std/logger/package.d | 1 | ||||
-rw-r--r-- | libphobos/src/std/range/primitives.d | 15 |
4 files changed, 28 insertions, 1 deletions
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index 8c536ce..95b2778 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE @@ -1,4 +1,4 @@ -1c98326e787e504d9045004e593273ec99b13121 +fc06c514a8c4492f60fc89b8c4f857e6932fbcbd The first line of this file holds the git revision number of the last merge done from the dlang/phobos repository. diff --git a/libphobos/src/std/container/array.d b/libphobos/src/std/container/array.d index 0d6be93..ad120c1 100644 --- a/libphobos/src/std/container/array.d +++ b/libphobos/src/std/container/array.d @@ -594,6 +594,10 @@ if (!is(immutable T == immutable bool)) assert(capacity == values.length); // We check that reserve has been called before the loop. } + /// ditto + // needed when T is an array and only one argument is passed + this(T single) { __ctor!T(single); } + /** * Constructor taking an $(REF_ALTTEXT input range, isInputRange, std,range,primitives) */ @@ -1282,6 +1286,13 @@ if (!is(immutable T == immutable bool)) } } +@system unittest +{ + import std.algorithm.comparison : equal; + auto a = Array!string("test"); + assert(a[].equal(["test"])); +} + @safe unittest { // https://issues.dlang.org/show_bug.cgi?id=13621 diff --git a/libphobos/src/std/logger/package.d b/libphobos/src/std/logger/package.d index 4f4183c..330ef88 100644 --- a/libphobos/src/std/logger/package.d +++ b/libphobos/src/std/logger/package.d @@ -54,6 +54,7 @@ $(UL $(LI `trace`) $(LI `info`) $(LI `warning`) + #(LI `error`) $(LI `critical`) $(LI `fatal`) ) diff --git a/libphobos/src/std/range/primitives.d b/libphobos/src/std/range/primitives.d index 89cfa07..fec5c85 100644 --- a/libphobos/src/std/range/primitives.d +++ b/libphobos/src/std/range/primitives.d @@ -1015,12 +1015,27 @@ See_Also: enum bool isForwardRange(R) = isInputRange!R && is(typeof((R r) { return r.save; } (R.init)) == R); +/// ditto +enum bool isForwardRange(R, E) = + .isForwardRange!R && isQualifierConvertible!(ElementType!R, E); + /// @safe unittest { static assert(!isForwardRange!(int)); static assert( isForwardRange!(int[])); static assert( isForwardRange!(inout(int)[])); + + static assert( isForwardRange!(int[], const int)); + static assert(!isForwardRange!(int[], immutable int)); + + static assert(!isForwardRange!(const(int)[], int)); + static assert( isForwardRange!(const(int)[], const int)); + static assert(!isForwardRange!(const(int)[], immutable int)); + + static assert(!isForwardRange!(immutable(int)[], int)); + static assert( isForwardRange!(immutable(int)[], const int)); + static assert( isForwardRange!(immutable(int)[], immutable int)); } @safe unittest |