diff options
| author | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-10-15 19:09:05 +0200 |
|---|---|---|
| committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-10-16 19:14:10 +0200 |
| commit | 964fd402c9b48eb4da91fb3e4e45d4560d6c676c (patch) | |
| tree | a34980fffb3f1e8e7347b727a6d7243cc0ad7320 /libphobos/src | |
| parent | c7609acb8a8210188d21b2cd72ecc6d3b2de2ab8 (diff) | |
d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
D front-end changes:
- Import latest fixes to mainline.
D runtime changes:
- Import latest fixes to mainline.
Phobos changes:
- Import latest fixes to mainline.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 4c18eed967.
* d-diagnostic.cc (verrorReport): Update for new front-end interface.
(verrorReportSupplemental): Likewise.
* d-lang.cc (d_init_options): Likewise.
(d_handle_option): Likewise.
(d_post_options): Likewise.
(d_parse_file): Likewise.
* decl.cc (get_symbol_decl): Likewise.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 4c18eed967.
* src/MERGE: Merge upstream phobos d945686a4.
Diffstat (limited to 'libphobos/src')
| -rw-r--r-- | libphobos/src/MERGE | 2 | ||||
| -rw-r--r-- | libphobos/src/std/algorithm/iteration.d | 6 | ||||
| -rw-r--r-- | libphobos/src/std/range/primitives.d | 24 |
3 files changed, 24 insertions, 8 deletions
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index 455825b8781..9a979272d6e 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE @@ -1,4 +1,4 @@ -a3f22129dd2a134338ca02b79ff0de242d7f016e +d945686a4ff7d9fda0e2ee8d2ee201b66be2a287 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/algorithm/iteration.d b/libphobos/src/std/algorithm/iteration.d index 39927be9bbb..0adb88b2210 100644 --- a/libphobos/src/std/algorithm/iteration.d +++ b/libphobos/src/std/algorithm/iteration.d @@ -2975,9 +2975,9 @@ auto joiner(RoR, Separator)(RoR r, Separator sep) static assert(isInputRange!(ElementType!RoR), "The ElementyType of RoR '" , ElementType!(RoR).stringof, "' must be an InputRange " , "(isInputRange!(ElementType!(", RoR.stringof , ")))."); - static assert(isForwardRange!Separator, "The type of the Seperator '" - , Seperator.stringof, "' must be a ForwardRange (isForwardRange!(" - , Seperator.stringof, "))."); + static assert(isForwardRange!Separator, "The type of the Separator '" + , Separator.stringof, "' must be a ForwardRange (isForwardRange!(" + , Separator.stringof, "))."); static assert(is(ElementType!Separator : ElementType!(ElementType!RoR)) , "The type of the elements of the separator range does not match " , "the type of the elements that are joined. Separator type '" diff --git a/libphobos/src/std/range/primitives.d b/libphobos/src/std/range/primitives.d index e581409ba32..ef34a85e5ec 100644 --- a/libphobos/src/std/range/primitives.d +++ b/libphobos/src/std/range/primitives.d @@ -165,17 +165,21 @@ See_Also: Params: R = type to be tested + E = the type of the elements of the range if not `void` Returns: - `true` if R is an input range, `false` if not + `true` if R is an input range (possibly with element type `E`), `false` if not */ -enum bool isInputRange(R) = +enum bool isInputRange(R, E = void) = is(typeof(R.init) == R) && is(typeof((R r) { return r.empty; } (R.init)) == bool) && (is(typeof((return ref R r) => r.front)) || is(typeof(ref (return ref R r) => r.front))) && !is(typeof((R r) { return r.front; } (R.init)) == void) - && is(typeof((R r) => r.popFront)); - + && is(typeof((R r) => r.popFront)) + && (is(E == void) || + is(ElementType!R == E) || + is(const(ElementType!R) == E) || + (is(const(ElementType!R) == immutable E) && is(const(E) == E))); /// @safe unittest { @@ -192,6 +196,18 @@ enum bool isInputRange(R) = static assert( isInputRange!(char[])); static assert(!isInputRange!(char[4])); static assert( isInputRange!(inout(int)[])); + static assert(!isInputRange!(int[], string)); + static assert( isInputRange!(int[], int)); + static assert( isInputRange!(int[], const int)); + static assert(!isInputRange!(int[], immutable int)); + + static assert(!isInputRange!(const(int)[], int)); + static assert( isInputRange!(const(int)[], const int)); + static assert(!isInputRange!(const(int)[], immutable int)); + + static assert(!isInputRange!(immutable(int)[], int)); + static assert( isInputRange!(immutable(int)[], const int)); + static assert( isInputRange!(immutable(int)[], immutable int)); static struct NotDefaultConstructible { |
