From 17005e4ac9bbd151ffb779c48e11c4b53d32c78f Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 6 Oct 2017 12:28:14 +0200 Subject: [PATCH] Fix isInnerClass for templates, sort unittest attributes --- source/tanya/meta/metafunction.d | 90 +++++++++---------- source/tanya/meta/trait.d | 150 ++++++++++++++++--------------- source/tanya/meta/transform.d | 40 ++++----- 3 files changed, 144 insertions(+), 136 deletions(-) diff --git a/source/tanya/meta/metafunction.d b/source/tanya/meta/metafunction.d index e126ed3..b3eb82f 100644 --- a/source/tanya/meta/metafunction.d +++ b/source/tanya/meta/metafunction.d @@ -61,7 +61,7 @@ if (Args.length > 0 && isTemplate!pred) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum bool cmp(alias T, alias U) = T < U; static assert(Min!(cmp, 8, 4, 5, 3, 13) == 3); @@ -108,7 +108,7 @@ if (Args.length > 0 && isTemplate!pred) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum bool cmp(alias T, alias U) = T < U; static assert(Max!(cmp, 8, 4, 5, 3, 13) == 13); @@ -180,7 +180,7 @@ if (Tuples.length > 0 } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias Result1 = ZipWith!(AliasSeq, Tuple!(1, 2), @@ -242,7 +242,7 @@ template Tuple(Args...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias A = Tuple!(short); alias B = Tuple!(3, 8, 9); @@ -280,7 +280,7 @@ template Set(Args...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias S1 = Set!(int, 5, 5, int, 4); static assert(S1.length == 3); @@ -315,7 +315,7 @@ if (allSatisfy!(ApplyLeft!(isInstanceOf, Set), Sets)) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias S1 = Set!(2, 5, 8, 4); alias S2 = Set!(3, 8, 4, 1); @@ -368,7 +368,7 @@ if (allSatisfy!(ApplyLeft!(isInstanceOf, Set), Sets)) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias S1 = Set!(2, 5, 8, 4); alias S2 = Set!(3, 8, 4, 1); @@ -415,7 +415,7 @@ if (isInstanceOf!(Set, S1) && isInstanceOf!(Set, S2)) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias S1 = Set!(2, 5, 8, 4); alias S2 = Set!(3, 8, 4, 1); @@ -458,7 +458,7 @@ if (Args.length == 2 && isTemplate!cmp) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum bool boolCmp(T, U) = T.sizeof < U.sizeof; static assert(isLessEqual!(boolCmp, byte, int)); @@ -505,7 +505,7 @@ if (Args.length == 2 && isTemplate!cmp) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum bool boolCmp(T, U) = T.sizeof < U.sizeof; static assert(!isGreaterEqual!(boolCmp, byte, int)); @@ -552,7 +552,7 @@ if (Args.length == 2 && isTemplate!cmp) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum bool boolCmp(T, U) = T.sizeof < U.sizeof; static assert(isLess!(boolCmp, byte, int)); @@ -599,7 +599,7 @@ if (Args.length == 2 && isTemplate!cmp) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum bool boolCmp(T, U) = T.sizeof < U.sizeof; static assert(!isGreater!(boolCmp, byte, int)); @@ -644,7 +644,7 @@ if (Args.length == 2) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isEqual!(int, int)); static assert(isEqual!(8, 8)); @@ -674,7 +674,7 @@ if (Args.length == 2) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(!isNotEqual!(int, int)); static assert(isNotEqual!(5, int)); @@ -693,7 +693,7 @@ pure nothrow @safe @nogc unittest alias Instantiate(alias T, Args...) = T!Args; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { template Template(T) { @@ -738,7 +738,7 @@ alias Alias(alias T) = T; alias Alias(T) = T; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Alias!int)); @@ -769,7 +769,7 @@ pure nothrow @safe @nogc unittest alias AliasSeq(Args...) = Args; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(typeof({ alias T = AliasSeq!(short, 5); }))); static assert(is(typeof({ alias T = AliasSeq!(int, short, 5); }))); @@ -817,7 +817,7 @@ if (isTemplate!F) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(allSatisfy!(isSigned, int, short, byte, long)); static assert(!allSatisfy!(isUnsigned, uint, ushort, float, ulong)); @@ -855,7 +855,7 @@ if (isTemplate!F) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(anySatisfy!(isSigned, int, short, byte, long)); static assert(anySatisfy!(isUnsigned, uint, ushort, float, ulong)); @@ -902,7 +902,7 @@ template staticIndexOf(alias T, L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(staticIndexOf!(int) == -1); static assert(staticIndexOf!(int, int) == 0); @@ -933,7 +933,7 @@ template canFind(alias T, L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(!canFind!(int)); static assert(canFind!(int, int)); @@ -973,7 +973,7 @@ if (allSatisfy!(isTemplate, Preds)) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias isMutableInt = templateAnd!(isIntegral, isMutable); static assert(isMutableInt!int); @@ -1021,7 +1021,7 @@ if (allSatisfy!(isTemplate, Preds)) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias isMutableOrInt = templateOr!(isIntegral, isMutable); static assert(isMutableOrInt!int); @@ -1051,7 +1051,7 @@ if (isTemplate!pred) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias isNotIntegral = templateNot!isIntegral; static assert(!isNotIntegral!int); @@ -1095,7 +1095,7 @@ if (isTemplate!cmp) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum cmp(T, U) = T.sizeof < U.sizeof; static assert(isSorted!(cmp)); @@ -1104,7 +1104,7 @@ pure nothrow @safe @nogc unittest static assert(!isSorted!(cmp, long, byte, ubyte, short, uint)); } -private pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum cmp(int x, int y) = x - y; static assert(isSorted!(cmp)); @@ -1116,7 +1116,7 @@ private pure nothrow @safe @nogc unittest static assert(isSorted!(cmp, 32, 32)); } -private pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum cmp(int x, int y) = x < y; static assert(isSorted!(cmp)); @@ -1142,7 +1142,7 @@ template ApplyLeft(alias T, Args...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias allAreIntegral = ApplyLeft!(allSatisfy, isIntegral); static assert(allAreIntegral!(int, uint)); @@ -1163,7 +1163,7 @@ template ApplyRight(alias T, Args...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias intIs = ApplyRight!(allSatisfy, int); static assert(intIs!(isIntegral)); @@ -1191,7 +1191,7 @@ if (n > 0) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Repeat!(1, uint, int) == AliasSeq!(uint, int))); static assert(is(Repeat!(2, uint, int) == AliasSeq!(uint, int, uint, int))); @@ -1249,7 +1249,7 @@ template Replace(alias T, alias U, L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Replace!(int, uint, int) == AliasSeq!(uint))); static assert(is(Replace!(int, uint, short, int, int, ushort) @@ -1312,7 +1312,7 @@ template ReplaceAll(alias T, alias U, L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(ReplaceAll!(int, uint, int) == AliasSeq!(uint))); static assert(is(ReplaceAll!(int, uint, short, int, int, ushort) @@ -1340,7 +1340,7 @@ template Reverse(L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Reverse!(byte, short, int) == AliasSeq!(int, short, byte))); } @@ -1368,7 +1368,7 @@ if (isTemplate!F) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Map!(Unqual, const int, immutable short) == AliasSeq!(int, short))); @@ -1429,14 +1429,14 @@ if (isTemplate!cmp) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum cmp(T, U) = T.sizeof < U.sizeof; static assert(is(Sort!(cmp, long, short, byte, int) == AliasSeq!(byte, short, int, long))); } -private pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum cmp(int T, int U) = T - U; static assert(Sort!(cmp, 5, 17, 9, 12, 2, 10, 14) @@ -1460,7 +1460,7 @@ template DerivedToFront(L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { class A { @@ -1501,7 +1501,7 @@ template MostDerived(T, L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { class A { @@ -1554,7 +1554,7 @@ template Erase(alias T, L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Erase!(int, short, int, int, uint) == AliasSeq!(short, int, uint))); static assert(is(Erase!(int, short, uint) == AliasSeq!(short, uint))); @@ -1597,7 +1597,7 @@ template EraseAll(alias T, L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(EraseAll!(int, short, int, int, uint) == AliasSeq!(short, uint))); static assert(is(EraseAll!(int, short, uint) == AliasSeq!(short, uint))); @@ -1632,7 +1632,7 @@ template Filter(alias pred, L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Filter!(isIntegral, real, int, bool, uint) == AliasSeq!(int, uint))); } @@ -1659,7 +1659,7 @@ template NoDuplicates(L...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias Types = AliasSeq!(int, uint, int, short, short, uint); static assert(is(NoDuplicates!Types == AliasSeq!(int, uint, short))); @@ -1702,7 +1702,7 @@ template aliasSeqOf(alias range) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(aliasSeqOf!([0, 1, 2, 3]) == AliasSeq!(0, 1, 2, 3)); } @@ -1735,7 +1735,7 @@ if (n > 0) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(Stride!(3, 1, 2, 3, 4, 5, 6, 7, 8) == AliasSeq!(1, 4, 7)); static assert(Stride!(2, 1, 2, 3) == AliasSeq!(1, 3)); @@ -1770,7 +1770,7 @@ if (T.length == 2) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Select!(true, int, float) == int)); static assert(is(Select!(false, int, float) == float)); diff --git a/source/tanya/meta/trait.d b/source/tanya/meta/trait.d index 05bda9e..b12cc84 100644 --- a/source/tanya/meta/trait.d +++ b/source/tanya/meta/trait.d @@ -45,7 +45,7 @@ import tanya.meta.transform; enum bool isWideString(T) = is(T : const dchar[]) && !isStaticArray!T; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isWideString!(dchar[])); static assert(!isWideString!(char[])); @@ -101,7 +101,7 @@ if (Args.length >= 1) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Smallest!(int, ushort, uint, short) == ushort)); static assert(is(Smallest!(short) == short)); @@ -136,7 +136,7 @@ enum bool isComplex(T) = is(Unqual!(OriginalType!T) == cfloat) || is(Unqual!(OriginalType!T) == ireal); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isComplex!cfloat); static assert(isComplex!ifloat); @@ -163,7 +163,7 @@ pure nothrow @safe @nogc unittest enum bool isPOD(T) = __traits(isPOD, T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S1 { @@ -199,7 +199,7 @@ pure nothrow @safe @nogc unittest enum size_t sizeOf(T) = T.sizeof; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(sizeOf!(bool function()) == size_t.sizeof); static assert(sizeOf!bool == 1); @@ -220,7 +220,7 @@ pure nothrow @safe @nogc unittest enum size_t alignOf(T) = T.alignof; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(alignOf!bool == bool.alignof); static assert(is(typeof(alignOf!bool) == typeof(bool.alignof))); @@ -243,7 +243,7 @@ if (Args.length == 2) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isSame!("string", "string")); static assert(!isSame!(string, immutable(char)[])); @@ -266,7 +266,7 @@ pure nothrow @safe @nogc unittest enum bool isTemplate(alias T) = __traits(isTemplate, T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S(T) { @@ -338,7 +338,7 @@ template hasStaticMember(T, string member) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S { @@ -380,7 +380,7 @@ enum bool isFloatingPoint(T) = is(Unqual!(OriginalType!T) == double) || is(Unqual!(OriginalType!T) == real); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isFloatingPoint!float); static assert(isFloatingPoint!double); @@ -420,7 +420,7 @@ enum bool isSigned(T) = is(Unqual!(OriginalType!T) == byte) || isFloatingPoint!T; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isSigned!byte); static assert(isSigned!short); @@ -461,7 +461,7 @@ enum bool isUnsigned(T) = is(Unqual!(OriginalType!T) == ubyte) || is(Unqual!(OriginalType!T) == ulong); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isUnsigned!ubyte); static assert(isUnsigned!ushort); @@ -505,7 +505,7 @@ enum bool isIntegral(T) = isUnsigned!T || is(Unqual!(OriginalType!T) == long); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isIntegral!ubyte); static assert(isIntegral!byte); @@ -529,7 +529,7 @@ pure nothrow @safe @nogc unittest enum bool isNumeric(T) = isIntegral!T || isFloatingPoint!T || isComplex!T; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias F = float; static assert(isNumeric!F); @@ -550,7 +550,7 @@ pure nothrow @safe @nogc unittest enum bool isBoolean(T) = is(Unqual!(OriginalType!T) == bool); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isBoolean!bool); static assert(isBoolean!(shared const bool)); @@ -603,7 +603,7 @@ enum bool isSomeChar(T) = is(Unqual!(OriginalType!T) == char) || is(Unqual!(OriginalType!T) == dchar); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isSomeChar!char); static assert(isSomeChar!wchar); @@ -635,7 +635,7 @@ pure nothrow @safe @nogc unittest enum bool isScalarType(T) = isNumeric!T || isBoolean!T || isSomeChar!T; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isScalarType!int); static assert(!isScalarType!(int[])); @@ -657,7 +657,7 @@ pure nothrow @safe @nogc unittest enum bool isBasicType(T) = isScalarType!T || is(T : void); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static struct S { @@ -700,7 +700,7 @@ template isPointer(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isPointer!(bool*)); static assert(isPointer!(const bool*)); @@ -733,7 +733,7 @@ template isArray(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isArray!(bool[])); static assert(isArray!(const bool[])); @@ -767,7 +767,7 @@ template isStaticArray(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isStaticArray!(bool[8])); static assert(isStaticArray!(const bool[8])); @@ -791,7 +791,7 @@ pure nothrow @safe @nogc unittest enum bool isDynamicArray(T) = isArray!T && !isStaticArray!T; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isDynamicArray!(bool[])); static assert(isDynamicArray!(const bool[])); @@ -825,7 +825,7 @@ template isAssociativeArray(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isAssociativeArray!(bool[string])); static assert(isAssociativeArray!(const bool[string])); @@ -855,7 +855,7 @@ enum bool isBuiltinType(T) = isBasicType!T || isAssociativeArray!T; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isBuiltinType!int); static assert(isBuiltinType!(int[])); @@ -887,7 +887,7 @@ enum bool isAggregateType(T) = is(T == struct) || is(T == union); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S; class C; @@ -929,7 +929,7 @@ enum bool isNarrowString(T) = (is(T : const char[]) || is (T : const wchar[])) && !isStaticArray!T; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isNarrowString!(char[])); static assert(isNarrowString!(wchar[])); @@ -978,7 +978,7 @@ pure nothrow @safe @nogc unittest enum bool isSomeString(T) = isNarrowString!T || isWideString!T; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isSomeString!(dchar[])); static assert(isSomeString!(char[])); @@ -1036,7 +1036,7 @@ template mostNegative(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(mostNegative!char == char.min); static assert(mostNegative!wchar == wchar.min); @@ -1085,7 +1085,7 @@ if (Args.length >= 1) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Largest!(int, short, uint) == int)); static assert(is(Largest!(short) == short)); @@ -1109,7 +1109,7 @@ pure nothrow @safe @nogc unittest enum bool isCopyable(T) = is(typeof({ T s1 = T.init; T s2 = s1; })); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S1 { @@ -1158,7 +1158,7 @@ pure nothrow @safe @nogc unittest enum bool isAbstractClass(T) = __traits(isAbstractClass, T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { class A { @@ -1201,7 +1201,7 @@ private enum bool isType(T) = true; enum bool isTypeTuple(Args...) = allSatisfy!(isType, Args); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isTypeTuple!(int, uint, Object)); static assert(isTypeTuple!()); @@ -1274,7 +1274,7 @@ template isExpressions(Args...) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isExpressions!(5, 8, 2)); static assert(isExpressions!()); @@ -1301,7 +1301,7 @@ pure nothrow @safe @nogc unittest enum bool isFinalClass(T) = __traits(isFinalClass, T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { final class A { @@ -1328,7 +1328,7 @@ pure nothrow @safe @nogc unittest enum bool isAbstractFunction(alias F) = __traits(isAbstractFunction, F); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { class A { @@ -1365,7 +1365,7 @@ pure nothrow @safe @nogc unittest enum bool isFinalFunction(alias F) = __traits(isFinalFunction, F); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { class A { @@ -1413,7 +1413,7 @@ if (F.length == 1) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isFunctionPointer!(void function())); static assert(!isFunctionPointer!(void delegate())); @@ -1470,7 +1470,7 @@ if (F.length == 1) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isDelegate!(void delegate())); static assert(!isDelegate!(void function())); @@ -1531,7 +1531,7 @@ if (F.length == 1) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(!isFunction!(void function())); static assert(!isFunction!(() {})); @@ -1580,7 +1580,7 @@ if (F.length == 1) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isSomeFunction!(void function())); static assert(isSomeFunction!(() {})); @@ -1627,7 +1627,7 @@ if (F.length == 1) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S { @@ -1652,7 +1652,7 @@ pure nothrow @safe @nogc unittest static assert(!isCallable!I); } -private pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S { @@ -1677,7 +1677,7 @@ private pure nothrow @safe @nogc unittest enum bool hasMember(T, string member) = __traits(hasMember, T, member); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S { @@ -1732,7 +1732,7 @@ template isMutable(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S { @@ -1797,7 +1797,7 @@ pure nothrow @safe unittest enum bool isNestedFunction(alias F) = __traits(isNested, F); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { void func() { @@ -1834,13 +1834,13 @@ if (isCallable!F) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(FunctionTypeOf!(void function()) == function)); static assert(is(FunctionTypeOf!(() {}) == function)); } -private pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(FunctionTypeOf!(void delegate()) == function)); @@ -1883,7 +1883,7 @@ private pure nothrow @safe @nogc unittest static assert(is(FunctionTypeOf!S == function)); } -private pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S2 { @@ -1917,7 +1917,7 @@ if (isCallable!F) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(ReturnType!(int delegate()) == int)); static assert(is(ReturnType!(bool function()) == bool)); @@ -1934,7 +1934,7 @@ pure nothrow @safe @nogc unittest alias TemplateOf(alias T : Base!Args, alias Base, Args...) = Base; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S(T) { @@ -1990,7 +1990,7 @@ template isInstanceOf(alias T, alias I) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S(T) { @@ -2020,7 +2020,7 @@ pure nothrow @safe @nogc unittest enum bool isImplicitlyConvertible(From, To) = is(From : To); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(isImplicitlyConvertible!(const(byte), byte)); static assert(isImplicitlyConvertible!(byte, char)); @@ -2056,7 +2056,7 @@ if (is(T == class) || (is(T == interface))) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { interface I1 { @@ -2113,7 +2113,7 @@ if (is(T == class) || is(T == interface)) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { interface I1 { @@ -2163,7 +2163,7 @@ if (is(T == class)) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { interface I1 { @@ -2199,7 +2199,7 @@ if (is(T == class) || is(T == interface)) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { interface I1 { @@ -2249,7 +2249,7 @@ template isAssignable(Lhs, Rhs = Lhs) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S1 { @@ -2290,7 +2290,7 @@ pure nothrow @safe @nogc unittest alias TemplateArgsOf(alias T : Base!Args, alias Base, Args...) = Args; /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { template T(A, B) { @@ -2320,7 +2320,7 @@ if (isCallable!F) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { int func(Object, uint[]); static assert(is(Parameters!func == AliasSeq!(Object, uint[]))); @@ -2368,7 +2368,7 @@ if (isCallable!F) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { int func(ref Object stuff, uint[] = null, scope uint k = 1); alias P = ParameterIdentifierTuple!func; @@ -2480,7 +2480,7 @@ if (isCallable!F) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { @property ref int func1() pure nothrow @safe @nogc shared scope; static assert((functionAttributes!func1 & FunctionAttribute.pure_) @@ -2548,7 +2548,7 @@ if (isCallable!F) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { void func1(int k, uint b = 5, int[] = [1, 2]); alias Defaults = ParameterDefaults!func1; @@ -2587,7 +2587,7 @@ template hasElaborateDestructor(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { class C { @@ -2653,7 +2653,7 @@ template hasElaborateCopyConstructor(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(!hasElaborateCopyConstructor!int); @@ -2715,7 +2715,7 @@ template hasElaborateAssign(T) } } -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(!hasElaborateAssign!int); @@ -2815,7 +2815,7 @@ if (is(T == class)) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { class C1 { @@ -2858,7 +2858,7 @@ template ifTestable(T, alias pred = a => a) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(ifTestable!int); @@ -2932,7 +2932,7 @@ template getUDAs(alias symbol, alias attr) alias getUDAs(alias symbol) = AliasSeq!(__traits(getAttributes, symbol)); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct Attr { @@ -2987,7 +2987,7 @@ template hasUDA(alias symbol, alias attr) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct Attr1 { @@ -3017,7 +3017,7 @@ pure nothrow @safe @nogc unittest */ template isInnerClass(T) { - static if (is(T == class) && is(Alias!(__traits(parent, T)) == class)) + static if (is(T == class) && is(typeof(T.outer) == class)) { enum bool isInnerClass = !canFind!("outer", __traits(allMembers, T)); } @@ -3028,7 +3028,7 @@ template isInnerClass(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { class A { @@ -3047,3 +3047,11 @@ pure nothrow @safe @nogc unittest static assert(isInnerClass!(O.I)); static assert(!isInnerClass!(O.Fake)); } + +@nogc nothrow pure @safe unittest +{ + class RefCountedStore(T) + { + } + static assert(!isInnerClass!(RefCountedStore!int)); +} diff --git a/source/tanya/meta/transform.d b/source/tanya/meta/transform.d index d3f8caf..5d4a50b 100644 --- a/source/tanya/meta/transform.d +++ b/source/tanya/meta/transform.d @@ -60,7 +60,7 @@ template Unqual(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Unqual!bool == bool)); static assert(is(Unqual!(immutable bool) == bool)); @@ -95,7 +95,7 @@ template OriginalType(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { enum E1 : const(int) { @@ -166,7 +166,7 @@ template CopyConstness(From, To) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(CopyConstness!(int, char) == char)); static assert(is(CopyConstness!(const int, char) == const char)); @@ -245,7 +245,7 @@ template CopyTypeQualifiers(From, To) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(CopyTypeQualifiers!(int, char) == char)); static assert(is(CopyTypeQualifiers!(const int, char) == const char)); @@ -297,7 +297,7 @@ if (isIntegral!T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Unsigned!byte == ubyte)); static assert(is(Unsigned!short == ushort)); @@ -350,7 +350,7 @@ if (isIntegral!T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Signed!ubyte == byte)); static assert(is(Signed!ushort == short)); @@ -386,7 +386,7 @@ template PointerTarget(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(PointerTarget!(bool*) == bool)); static assert(is(PointerTarget!(const bool*) == const bool)); @@ -413,7 +413,7 @@ template KeyType(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(KeyType!(int[string]) == string)); static assert(!is(KeyType!(int[15]))); @@ -438,7 +438,7 @@ template ValueType(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(ValueType!(int[string]) == int)); static assert(!is(ValueType!(int[15]))); @@ -460,7 +460,7 @@ if (isScalarType!T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(Promoted!bool == int)); static assert(is(Promoted!byte == int)); @@ -486,7 +486,7 @@ pure nothrow @safe @nogc unittest alias InoutOf(T) = inout(T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(InoutOf!int == inout int)); } @@ -502,7 +502,7 @@ pure nothrow @safe @nogc unittest alias ConstOf(T) = const(T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(ConstOf!int == const int)); } @@ -518,7 +518,7 @@ pure nothrow @safe @nogc unittest alias SharedOf(T) = shared(T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(SharedOf!int == shared int)); } @@ -534,7 +534,7 @@ pure nothrow @safe @nogc unittest alias SharedInoutOf(T) = shared(inout T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(SharedInoutOf!int == shared inout int)); } @@ -550,7 +550,7 @@ pure nothrow @safe @nogc unittest alias SharedConstOf(T) = shared(const T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(SharedConstOf!int == shared const int)); } @@ -566,7 +566,7 @@ pure nothrow @safe @nogc unittest alias ImmutableOf(T) = immutable(T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(ImmutableOf!int == immutable int)); } @@ -582,7 +582,7 @@ pure nothrow @safe @nogc unittest alias InoutConstOf(T) = inout(const T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(InoutConstOf!int == inout const int)); } @@ -598,7 +598,7 @@ pure nothrow @safe @nogc unittest alias SharedInoutConstOf(T) = shared(inout const T); /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { static assert(is(SharedInoutConstOf!int == shared inout const int)); } @@ -653,7 +653,7 @@ template QualifierOf(T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { alias MutableOf = QualifierOf!int; static assert(is(MutableOf!uint == uint)); @@ -707,7 +707,7 @@ if (isExpressions!T || isTemplate!T) } /// -pure nothrow @safe @nogc unittest +@nogc nothrow pure @safe unittest { struct S(T) {