Make isWideString compatible with Phobos isNarrowString

This commit is contained in:
2025-08-25 14:32:34 +02:00
parent 260b131222
commit 720d259cfc
22 changed files with 30 additions and 1649 deletions

View File

@@ -18,7 +18,7 @@
*/
module tanya.meta.metafunction;
import std.traits : Unqual;
import std.traits : Unqual, isInstanceOf, isMutable, isTypeTuple, isUnsigned, isSigned, isIntegral;
import std.meta : NoDuplicates;
import tanya.meta.trait;

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@
*/
module tanya.memory.allocator;
import std.traits : hasElaborateDestructor;
import std.traits : hasElaborateDestructor, isAssociativeArray, isArray;
import tanya.memory.lifetime;
import tanya.meta.trait;

View File

@@ -14,7 +14,8 @@
*/
module tanya.memory.lifetime;
import std.traits : isInnerClass, hasElaborateAssign, hasElaborateCopyConstructor, hasElaborateDestructor;
import std.traits : isInnerClass, hasElaborateAssign, hasElaborateCopyConstructor, hasElaborateDestructor,
isAssignable, isNested, isAbstractClass, isAggregateType, isStaticArray;
import tanya.memory.allocator;
import tanya.meta.metafunction;
import tanya.meta.trait;

View File

@@ -23,6 +23,7 @@
*/
module tanya.memory.smartref;
import std.traits : isPointer, isAbstractClass, isAssociativeArray, isDynamicArray, isArray;
import tanya.memory.allocator;
import tanya.memory.lifetime;
import tanya.meta.trait;

View File

@@ -20,7 +20,7 @@
*/
module tanya.algorithm.iteration;
import std.traits : Unqual;
import std.traits : Unqual, isMutable;
import std.typecons;
import tanya.memory.lifetime;
import tanya.meta.trait;

View File

@@ -14,7 +14,8 @@
*/
module tanya.algorithm.mutation;
import std.traits : Unqual, hasElaborateAssign, hasElaborateCopyConstructor, hasElaborateDestructor;
import std.traits : Unqual, hasElaborateAssign, hasElaborateCopyConstructor, hasElaborateDestructor, isAssignable,
isDynamicArray;
static import tanya.memory.lifetime;
static import tanya.memory.op;
import tanya.meta.trait;

View File

@@ -18,7 +18,7 @@ import core.checkedint;
import std.algorithm.comparison;
import std.algorithm.iteration;
import std.algorithm.mutation : bringToFront;
import std.traits : PointerTarget, Unqual, hasElaborateDestructor;
import std.traits : PointerTarget, Unqual, hasElaborateDestructor, isImplicitlyConvertible, isCopyable;
import tanya.algorithm.mutation;
import tanya.memory.allocator;
import tanya.memory.lifetime;

View File

@@ -15,7 +15,7 @@
module tanya.container.hashtable;
import std.algorithm.iteration;
import std.traits : CopyConstness, Unqual, ifTestable;
import std.traits : CopyConstness, Unqual, ifTestable, isMutable;
import tanya.algorithm.mutation;
import tanya.container.array;
import tanya.container.entry;

View File

@@ -17,7 +17,7 @@ module tanya.container.list;
import std.algorithm.comparison;
import std.algorithm.iteration;
import std.traits : Unqual;
import std.traits : Unqual, isImplicitlyConvertible, isCopyable;
import tanya.container.entry;
import tanya.memory.allocator;
import tanya.memory.lifetime;

View File

@@ -15,7 +15,7 @@
*/
module tanya.container.set;
import std.traits : CopyConstness, Unqual, ifTestable;
import std.traits : CopyConstness, Unqual, ifTestable, isImplicitlyConvertible, isMutable;
import tanya.container.array;
import tanya.container.entry;
import tanya.hash.lookup;

View File

@@ -28,7 +28,7 @@ module tanya.container.string;
import std.algorithm.comparison;
import std.algorithm.mutation : bringToFront;
import std.traits : CopyConstness, Unqual;
import std.traits : CopyConstness, Unqual, isInstanceOf, isSomeChar, isNarrowString;
import tanya.algorithm.mutation;
import tanya.hash.lookup;
import tanya.memory.allocator;

View File

@@ -14,7 +14,8 @@
*/
module tanya.conv;
import std.traits : Unsigned, isNumeric, Largest, Unqual, EnumMembers;
import std.traits : Unsigned, isNumeric, Largest, Unqual, EnumMembers, isFloatingPoint, isSomeChar, isSigned,
isUnsigned, isIntegral, isSomeString;
import tanya.container.string;
import tanya.memory.allocator;
import tanya.meta.trait;

View File

@@ -49,7 +49,7 @@ module tanya.format;
import std.algorithm.comparison;
import std.ascii;
import std.traits : Unqual;
import std.traits : Unqual, isPointer, isSomeChar, isFloatingPoint, isSomeFunction, isIntegral, isSomeString;
import tanya.container.string;
import tanya.math;
static import tanya.memory.op;

View File

@@ -14,7 +14,7 @@
*/
module tanya.hash.lookup;
import std.traits : isScalarType;
import std.traits : isScalarType, isPointer, isSomeChar, isArray, isIntegral, isBoolean;
import tanya.meta.trait;
import tanya.range.primitive;

View File

@@ -22,7 +22,7 @@
module tanya.math;
import std.math;
import std.traits : Unqual;
import std.traits : Unqual, isFloatingPoint;
import tanya.meta.trait;
/// Floating-point number precisions according to IEEE-754.

View File

@@ -14,7 +14,7 @@
*/
module tanya.net.inet;
import std.traits : Unqual;
import std.traits : Unqual, isUnsigned;
import tanya.meta.trait;
import tanya.range;

View File

@@ -14,6 +14,7 @@
*/
module tanya.range.adapter;
import std.traits : hasMember, isArray;
import tanya.algorithm.mutation;
import tanya.memory.lifetime;
import tanya.meta.trait;

View File

@@ -15,7 +15,7 @@
module tanya.range.primitive;
import std.algorithm.comparison;
import std.traits : FunctionAttribute, hasElaborateCopyConstructor, functionAttributes;
import std.traits : FunctionAttribute, ReturnType, hasElaborateCopyConstructor, functionAttributes;
import tanya.memory.lifetime;
import tanya.meta.trait;
import tanya.range.array;

View File

@@ -22,6 +22,7 @@
*/
module tanya.test.assertion;
import std.traits : isSomeFunction;
import tanya.memory.allocator;
import tanya.meta.trait;

View File

@@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module tanya.memory.tests.smartref;
import std.traits : ReturnType;
import tanya.memory.allocator;
import tanya.memory.smartref;
import tanya.meta.trait;

View File

@@ -1,91 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module tanya.meta.tests.trait;
import tanya.meta.metafunction;
import tanya.meta.trait;
// typeof(null) is not a pointer.
@nogc nothrow pure @safe unittest
{
static assert(!isPointer!(typeof(null)));
static assert(!isPointer!(const shared typeof(null)));
enum typeOfNull : typeof(null)
{
null_ = null,
}
static assert(!isPointer!typeOfNull);
}
@nogc nothrow pure @safe unittest
{
static struct S
{
@property int opCall()
{
return 0;
}
}
S s;
static assert(isCallable!S);
static assert(isCallable!s);
}
@nogc nothrow pure @safe unittest
{
static assert(is(FunctionTypeOf!(void delegate()) == function));
static void staticFunc()
{
}
auto functionPointer = &staticFunc;
static assert(is(FunctionTypeOf!staticFunc == function));
static assert(is(FunctionTypeOf!functionPointer == function));
void func()
{
}
auto dg = &func;
static assert(is(FunctionTypeOf!func == function));
static assert(is(FunctionTypeOf!dg == function));
interface I
{
@property int prop();
}
static assert(is(FunctionTypeOf!(I.prop) == function));
static struct S
{
void opCall()
{
}
}
class C
{
static void opCall()
{
}
}
S s;
static assert(is(FunctionTypeOf!s == function));
static assert(is(FunctionTypeOf!C == function));
static assert(is(FunctionTypeOf!S == function));
}
@nogc nothrow pure @safe unittest
{
static struct S2
{
@property int opCall()
{
return 0;
}
}
S2 s2;
static assert(is(FunctionTypeOf!S2 == function));
static assert(is(FunctionTypeOf!s2 == function));
}