From 276053dd07029f30ff89b11f9a200ef04d925087 Mon Sep 17 00:00:00 2001 From: Boris Carvajal Date: Sun, 21 Feb 2021 02:53:49 -0300 Subject: [PATCH] Remove a few uses of fully qualified names that rely on a DMD bug --- std/algorithm/iteration.d | 8 ++++---- std/algorithm/searching.d | 4 ++-- std/array.d | 6 +++--- std/datetime/systime.d | 4 ++-- std/parallelism.d | 4 ++-- std/typecons.d | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/std/algorithm/iteration.d b/std/algorithm/iteration.d index e52da8642..d18eb675a 100644 --- a/std/algorithm/iteration.d +++ b/std/algorithm/iteration.d @@ -786,9 +786,9 @@ private struct MapResult(alias fun, Range) string s1 = "hello world!"; dstring s2 = "日本語"; dstring s3 = "hello world!"d; - auto ms1 = map!(std.ascii.toUpper)(s1); - auto ms2 = map!(std.ascii.toUpper)(s2); - auto ms3 = map!(std.ascii.toUpper)(s3); + auto ms1 = map!(toUpper)(s1); + auto ms2 = map!(toUpper)(s2); + auto ms3 = map!(toUpper)(s3); static assert(!is(ms1[0])); //narrow strings can't be indexed assert(ms2[0] == '日'); assert(ms3[0] == 'H'); @@ -5459,7 +5459,7 @@ private struct SplitterResult(alias isTerminator, Range) ["là", "dove", "terminava", "quella", "valle"] )); assert(equal( - splitter!(std.uni.isWhite)("là dove terminava quella valle"), + splitter!(isWhite)("là dove terminava quella valle"), ["là", "dove", "terminava", "quella", "valle"] )); assert(equal(splitter!"a=='本'"("日本語"), ["日", "語"])); diff --git a/std/algorithm/searching.d b/std/algorithm/searching.d index f671b98de..7bd15709d 100644 --- a/std/algorithm/searching.d +++ b/std/algorithm/searching.d @@ -965,8 +965,8 @@ if (isInputRange!R && import std.ascii : isDigit; import std.uni : isWhite; - assert(countUntil!(std.uni.isWhite)("hello world") == 5); - assert(countUntil!(std.ascii.isDigit)("hello world") == -1); + assert(countUntil!(isWhite)("hello world") == 5); + assert(countUntil!(isDigit)("hello world") == -1); assert(countUntil!"a > 20"([0, 7, 12, 22, 9]) == 3); } diff --git a/std/array.d b/std/array.d index 97f2c1bd6..da58450a6 100644 --- a/std/array.d +++ b/std/array.d @@ -3636,13 +3636,13 @@ if (isDynamicArray!A) return app.data; } + import std.format : FormatSpec; + /// ditto template toString(Writer) if (isOutputRange!(Writer, char)) { - import std.format : FormatSpec; - - void toString(ref Writer w, scope const ref std.format.FormatSpec!char fmt) const + void toString(ref Writer w, scope const ref FormatSpec!char fmt) const { import std.format : formatValue; import std.range.primitives : put; diff --git a/std/datetime/systime.d b/std/datetime/systime.d index 70dc24de6..409e4212a 100644 --- a/std/datetime/systime.d +++ b/std/datetime/systime.d @@ -10364,7 +10364,7 @@ afterMon: stripAndCheckLen(value[3 .. value.length], "1200:00A".length); } // year - auto found = value[2 .. value.length].find!(not!(std.ascii.isDigit))(); + auto found = value[2 .. value.length].find!(not!(isDigit))(); size_t yearLen = value.length - found.length; if (found.length == 0) throw new DateTimeException("Invalid year"); @@ -10454,7 +10454,7 @@ afterMon: stripAndCheckLen(value[3 .. value.length], "1200:00A".length); case "J": case "j": throw new DateTimeException("Invalid timezone"); default: { - if (all!(std.ascii.isAlpha)(value[0 .. tzLen])) + if (all!(isAlpha)(value[0 .. tzLen])) { tz = new immutable SimpleTimeZone(Duration.zero); break; diff --git a/std/parallelism.d b/std/parallelism.d index 90642afbe..fb02f35e1 100644 --- a/std/parallelism.d +++ b/std/parallelism.d @@ -4150,7 +4150,7 @@ version (StdUnittest) import std.array : split; import std.conv : text; import std.exception : assertThrown; - import std.math : isClose, sqrt, log; + import std.math : isClose, sqrt, log, abs; import std.range : indexed, iota, join; import std.typecons : Tuple, tuple; import std.stdio; @@ -4480,7 +4480,7 @@ version (StdUnittest) assert(equal(iota(1_000_000), bufTrickTest)); - auto myTask = task!(std.math.abs)(-1); + auto myTask = task!(abs)(-1); taskPool.put(myTask); assert(myTask.spinForce == 1); diff --git a/std/typecons.d b/std/typecons.d index 5c3b3d772..2e98881fe 100644 --- a/std/typecons.d +++ b/std/typecons.d @@ -6088,7 +6088,7 @@ package template GetOverloadedMethods(T) enum isMethod = false; } alias follows = AliasSeq!( - std.meta.Filter!(isMethod, __traits(getOverloads, T, name)), + Filter!(isMethod, __traits(getOverloads, T, name)), follows!(i + 1)); } }