From 5cb96c6d929c6a54f391bac634f3c0616ec12dc5 Mon Sep 17 00:00:00 2001 From: Stanislav Blinov Date: Sat, 24 Nov 2018 19:16:10 +0300 Subject: [PATCH] Tentative fix for Issue 7270 --- src/object.d | 101 ++++++++++++++++++++++++++-------- src/rt/typeinfo/ti_Acdouble.d | 2 +- src/rt/typeinfo/ti_Acfloat.d | 2 +- src/rt/typeinfo/ti_Acreal.d | 2 +- src/rt/typeinfo/ti_Adouble.d | 4 +- src/rt/typeinfo/ti_Afloat.d | 4 +- src/rt/typeinfo/ti_Ag.d | 14 ++--- src/rt/typeinfo/ti_Aint.d | 6 +- src/rt/typeinfo/ti_Along.d | 4 +- src/rt/typeinfo/ti_Areal.d | 4 +- src/rt/typeinfo/ti_Ashort.d | 6 +- src/rt/typeinfo/ti_byte.d | 2 +- src/rt/typeinfo/ti_cdouble.d | 2 +- src/rt/typeinfo/ti_cfloat.d | 2 +- src/rt/typeinfo/ti_char.d | 2 +- src/rt/typeinfo/ti_creal.d | 2 +- src/rt/typeinfo/ti_dchar.d | 2 +- src/rt/typeinfo/ti_double.d | 2 +- src/rt/typeinfo/ti_float.d | 2 +- src/rt/typeinfo/ti_idouble.d | 2 +- src/rt/typeinfo/ti_ifloat.d | 2 +- src/rt/typeinfo/ti_int.d | 2 +- src/rt/typeinfo/ti_ireal.d | 2 +- src/rt/typeinfo/ti_long.d | 2 +- src/rt/typeinfo/ti_n.d | 2 +- src/rt/typeinfo/ti_real.d | 2 +- src/rt/typeinfo/ti_short.d | 2 +- src/rt/typeinfo/ti_ubyte.d | 4 +- src/rt/typeinfo/ti_uint.d | 2 +- src/rt/typeinfo/ti_ulong.d | 2 +- src/rt/typeinfo/ti_ushort.d | 2 +- src/rt/typeinfo/ti_void.d | 2 +- src/rt/typeinfo/ti_wchar.d | 2 +- 33 files changed, 125 insertions(+), 70 deletions(-) diff --git a/src/object.d b/src/object.d index 8bcfcb6ecf..c7c89703a0 100644 --- a/src/object.d +++ b/src/object.d @@ -1028,6 +1028,14 @@ struct OffsetTypeInfo TypeInfo ti; /// TypeInfo for this member } +enum ToStringContext +{ + none = 0x00, + const_ = 0x01, + shared_ = 0x02, + inout_ = 0x04, +} + /** * Runtime type information about a type. * Can be retrieved for any type using a @@ -1035,11 +1043,16 @@ struct OffsetTypeInfo */ class TypeInfo { - override string toString() const pure @safe nothrow + string toStringImpl(ToStringContext flags) const pure @safe nothrow { return typeid(this).name; } + override final string toString() const pure @safe nothrow + { + return toStringImpl(ToStringContext.init); + } + override size_t toHash() @trusted const nothrow { return hashOf(this.toString()); @@ -1147,7 +1160,7 @@ class TypeInfo class TypeInfo_Enum : TypeInfo { - override string toString() const { return name; } + override string toStringImpl(ToStringContext) const { return name; } override bool opEquals(Object o) { @@ -1196,7 +1209,7 @@ unittest // issue 12233 // Please make sure to keep this in sync with TypeInfo_P (src/rt/typeinfo/ti_ptr.d) class TypeInfo_Pointer : TypeInfo { - override string toString() const { return m_next.toString() ~ "*"; } + override string toStringImpl(ToStringContext) const { return m_next.toString() ~ "*"; } override bool opEquals(Object o) { @@ -1252,7 +1265,7 @@ class TypeInfo_Pointer : TypeInfo class TypeInfo_Array : TypeInfo { - override string toString() const { return value.toString() ~ "[]"; } + override string toStringImpl(ToStringContext flags) const { return value.toStringImpl(flags) ~ "[]"; } override bool opEquals(Object o) { @@ -1342,12 +1355,12 @@ class TypeInfo_Array : TypeInfo class TypeInfo_StaticArray : TypeInfo { - override string toString() const + override string toStringImpl(ToStringContext flags) const { import core.internal.string : unsignedToTempString; char[20] tmpBuff = void; - return value.toString() ~ "[" ~ unsignedToTempString(len, tmpBuff, 10) ~ "]"; + return value.toStringImpl(flags) ~ "[" ~ unsignedToTempString(len, tmpBuff, 10) ~ "]"; } override bool opEquals(Object o) @@ -1466,9 +1479,12 @@ class TypeInfo_StaticArray : TypeInfo class TypeInfo_AssociativeArray : TypeInfo { - override string toString() const + override string toStringImpl(ToStringContext flags) const { - return value.toString() ~ "[" ~ key.toString() ~ "]"; + if (flags & ToStringContext.const_) + return value.toStringImpl(ToStringContext.const_) ~ "[" ~ key.toString() ~ "]"; + else + return value.toString() ~ "[" ~ key.toString() ~ "]"; } override bool opEquals(Object o) @@ -1522,7 +1538,7 @@ class TypeInfo_AssociativeArray : TypeInfo class TypeInfo_Vector : TypeInfo { - override string toString() const { return "__vector(" ~ base.toString() ~ ")"; } + override string toStringImpl(ToStringContext flags) const { return "__vector(" ~ base.toStringImpl(flags) ~ ")"; } override bool opEquals(Object o) { @@ -1558,7 +1574,7 @@ class TypeInfo_Vector : TypeInfo class TypeInfo_Function : TypeInfo { - override string toString() const + override string toStringImpl(ToStringContext) const { import core.demangle : demangleType; @@ -1613,7 +1629,7 @@ unittest class TypeInfo_Delegate : TypeInfo { - override string toString() const + override string toStringImpl(ToStringContext) const { return cast(string)(next.toString() ~ " delegate()"); } @@ -1688,7 +1704,7 @@ class TypeInfo_Delegate : TypeInfo */ class TypeInfo_Class : TypeInfo { - override string toString() const { return info.name; } + override string toStringImpl(ToStringContext) const { return info.name; } override bool opEquals(Object o) { @@ -1843,7 +1859,7 @@ unittest class TypeInfo_Interface : TypeInfo { - override string toString() const { return info.name; } + override string toStringImpl(ToStringContext) const { return info.name; } override bool opEquals(Object o) { @@ -1916,7 +1932,7 @@ class TypeInfo_Interface : TypeInfo class TypeInfo_Struct : TypeInfo { - override string toString() const { return name; } + override string toStringImpl(ToStringContext) const { return name; } override bool opEquals(Object o) { @@ -2068,7 +2084,7 @@ class TypeInfo_Tuple : TypeInfo { TypeInfo[] elements; - override string toString() const + override string toStringImpl(ToStringContext) const { string s = "("; foreach (i, element; elements) @@ -2152,9 +2168,12 @@ class TypeInfo_Tuple : TypeInfo class TypeInfo_Const : TypeInfo { - override string toString() const + override string toStringImpl(ToStringContext flags) const pure @safe nothrow { - return cast(string) ("const(" ~ base.toString() ~ ")"); + if (flags & ToStringContext.const_) + return base.toStringImpl(flags); + else + return cast(string) ("const(" ~ base.toStringImpl(flags | ToStringContext.const_) ~ ")"); } //override bool opEquals(Object o) { return base.opEquals(o); } @@ -2194,27 +2213,63 @@ class TypeInfo_Const : TypeInfo TypeInfo base; } +unittest +{ + alias A = const(int[]); + alias B = const(const(int)[]); + assert(typeid(A) == typeid(B)); + assert(typeid(A).toString() == typeid(B).toString()); +} + class TypeInfo_Invariant : TypeInfo_Const { - override string toString() const + override string toStringImpl(ToStringContext flags) const { - return cast(string) ("immutable(" ~ base.toString() ~ ")"); + if (flags & ToStringContext.const_) + return base.toStringImpl(flags); + else + return cast(string) ("immutable(" ~ base.toStringImpl(flags | ToStringContext.const_) ~ ")"); } } +unittest +{ + alias A = immutable(int[]); + alias B = immutable(const(int)[]); + alias C = immutable(immutable(int)[]); + assert(typeid(A) == typeid(B)); + assert(typeid(B) == typeid(C)); + assert(typeid(A).toString() == typeid(B).toString()); + assert(typeid(B).toString() == typeid(C).toString()); +} + class TypeInfo_Shared : TypeInfo_Const { - override string toString() const + override string toStringImpl(ToStringContext flags) const { - return cast(string) ("shared(" ~ base.toString() ~ ")"); + if (flags & ToStringContext.shared_) + return base.toStringImpl(flags); + else + return cast(string) ("shared(" ~ base.toStringImpl(flags | ToStringContext.shared_) ~ ")"); } } +unittest +{ + alias A = shared(int[]); + alias B = shared(shared(int)[]); + assert(typeid(A) == typeid(B)); + assert(typeid(A).toString() == typeid(B).toString()); +} + class TypeInfo_Inout : TypeInfo_Const { - override string toString() const + override string toStringImpl(ToStringContext flags) const { - return cast(string) ("inout(" ~ base.toString() ~ ")"); + if (flags & ToStringContext.inout_) + return base.toStringImpl(flags); + else + return cast(string) ("inout(" ~ base.toStringImpl(flags | ToStringContext.inout_) ~ ")"); } } diff --git a/src/rt/typeinfo/ti_Acdouble.d b/src/rt/typeinfo/ti_Acdouble.d index 50debaca25..9abb790243 100644 --- a/src/rt/typeinfo/ti_Acdouble.d +++ b/src/rt/typeinfo/ti_Acdouble.d @@ -23,7 +23,7 @@ class TypeInfo_Ar : TypeInfo_Array override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return (F[]).stringof; } + override string toStringImpl(ToStringContext) const { return (F[]).stringof; } override size_t getHash(scope const void* p) @trusted const { diff --git a/src/rt/typeinfo/ti_Acfloat.d b/src/rt/typeinfo/ti_Acfloat.d index dadec10df7..3afd26545c 100644 --- a/src/rt/typeinfo/ti_Acfloat.d +++ b/src/rt/typeinfo/ti_Acfloat.d @@ -23,7 +23,7 @@ class TypeInfo_Aq : TypeInfo_Array override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return (F[]).stringof; } + override string toStringImpl(ToStringContext) const { return (F[]).stringof; } override size_t getHash(scope const void* p) @trusted const { diff --git a/src/rt/typeinfo/ti_Acreal.d b/src/rt/typeinfo/ti_Acreal.d index 650b89b4ed..6bd2172fae 100644 --- a/src/rt/typeinfo/ti_Acreal.d +++ b/src/rt/typeinfo/ti_Acreal.d @@ -23,7 +23,7 @@ class TypeInfo_Ac : TypeInfo_Array override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return (F[]).stringof; } + override string toStringImpl(ToStringContext) const { return (F[]).stringof; } override size_t getHash(scope const void* p) @trusted const { diff --git a/src/rt/typeinfo/ti_Adouble.d b/src/rt/typeinfo/ti_Adouble.d index 9712f8a822..81ab8ee909 100644 --- a/src/rt/typeinfo/ti_Adouble.d +++ b/src/rt/typeinfo/ti_Adouble.d @@ -23,7 +23,7 @@ class TypeInfo_Ad : TypeInfo_Array override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return (F[]).stringof; } + override string toStringImpl(ToStringContext) const { return (F[]).stringof; } override size_t getHash(scope const void* p) @trusted const { @@ -52,7 +52,7 @@ class TypeInfo_Ap : TypeInfo_Ad { alias F = idouble; - override string toString() const { return (F[]).stringof; } + override string toStringImpl(ToStringContext) const { return (F[]).stringof; } override @property inout(TypeInfo) next() inout { diff --git a/src/rt/typeinfo/ti_Afloat.d b/src/rt/typeinfo/ti_Afloat.d index 9a95abd3b5..8091c91ae4 100644 --- a/src/rt/typeinfo/ti_Afloat.d +++ b/src/rt/typeinfo/ti_Afloat.d @@ -23,7 +23,7 @@ class TypeInfo_Af : TypeInfo_Array override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return (F[]).stringof; } + override string toStringImpl(ToStringContext) const { return (F[]).stringof; } override size_t getHash(scope const void* p) @trusted const { @@ -52,7 +52,7 @@ class TypeInfo_Ao : TypeInfo_Af { alias F = ifloat; - override string toString() const { return (F[]).stringof; } + override string toStringImpl(ToStringContext) const { return (F[]).stringof; } override @property inout(TypeInfo) next() inout { diff --git a/src/rt/typeinfo/ti_Ag.d b/src/rt/typeinfo/ti_Ag.d index bdb0553698..52a2dfc15b 100644 --- a/src/rt/typeinfo/ti_Ag.d +++ b/src/rt/typeinfo/ti_Ag.d @@ -22,7 +22,7 @@ class TypeInfo_Ag : TypeInfo_Array { override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return "byte[]"; } + override string toStringImpl(ToStringContext) const { return "byte[]"; } override size_t getHash(scope const void* p) @trusted const { @@ -71,7 +71,7 @@ class TypeInfo_Ag : TypeInfo_Array class TypeInfo_Ah : TypeInfo_Ag { - override string toString() const { return "ubyte[]"; } + override string toStringImpl(ToStringContext) const { return "ubyte[]"; } override int compare(in void* p1, in void* p2) const { @@ -91,7 +91,7 @@ class TypeInfo_Ah : TypeInfo_Ag class TypeInfo_Av : TypeInfo_Ah { - override string toString() const { return "void[]"; } + override string toStringImpl(ToStringContext) const { return "void[]"; } override @property inout(TypeInfo) next() inout { @@ -103,7 +103,7 @@ class TypeInfo_Av : TypeInfo_Ah class TypeInfo_Ab : TypeInfo_Ah { - override string toString() const { return "bool[]"; } + override string toStringImpl(ToStringContext) const { return "bool[]"; } override @property inout(TypeInfo) next() inout { @@ -115,7 +115,7 @@ class TypeInfo_Ab : TypeInfo_Ah class TypeInfo_Aa : TypeInfo_Ah { - override string toString() const { return "char[]"; } + override string toStringImpl(ToStringContext) const { return "char[]"; } override size_t getHash(scope const void* p) @trusted const { @@ -133,7 +133,7 @@ class TypeInfo_Aa : TypeInfo_Ah class TypeInfo_Aya : TypeInfo_Aa { - override string toString() const { return "immutable(char)[]"; } + override string toStringImpl(ToStringContext) const { return "immutable(char)[]"; } override @property inout(TypeInfo) next() inout { @@ -145,7 +145,7 @@ class TypeInfo_Aya : TypeInfo_Aa class TypeInfo_Axa : TypeInfo_Aa { - override string toString() const { return "const(char)[]"; } + override string toStringImpl(ToStringContext) const { return "const(char)[]"; } override @property inout(TypeInfo) next() inout { diff --git a/src/rt/typeinfo/ti_Aint.d b/src/rt/typeinfo/ti_Aint.d index ebe8d80f93..3406f8e179 100644 --- a/src/rt/typeinfo/ti_Aint.d +++ b/src/rt/typeinfo/ti_Aint.d @@ -23,7 +23,7 @@ class TypeInfo_Ai : TypeInfo_Array { override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return "int[]"; } + override string toStringImpl(ToStringContext) const { return "int[]"; } override size_t getHash(scope const void* p) @trusted const { @@ -94,7 +94,7 @@ unittest class TypeInfo_Ak : TypeInfo_Ai { - override string toString() const { return "uint[]"; } + override string toStringImpl(ToStringContext) const { return "uint[]"; } override int compare(in void* p1, in void* p2) const { @@ -142,7 +142,7 @@ unittest class TypeInfo_Aw : TypeInfo_Ak { - override string toString() const { return "dchar[]"; } + override string toStringImpl(ToStringContext) const { return "dchar[]"; } override @property inout(TypeInfo) next() inout { diff --git a/src/rt/typeinfo/ti_Along.d b/src/rt/typeinfo/ti_Along.d index b67bb995ba..588b99d5d0 100644 --- a/src/rt/typeinfo/ti_Along.d +++ b/src/rt/typeinfo/ti_Along.d @@ -21,7 +21,7 @@ class TypeInfo_Al : TypeInfo_Array { override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return "long[]"; } + override string toStringImpl(ToStringContext) const { return "long[]"; } override size_t getHash(scope const void* p) @trusted const { @@ -72,7 +72,7 @@ class TypeInfo_Al : TypeInfo_Array class TypeInfo_Am : TypeInfo_Al { - override string toString() const { return "ulong[]"; } + override string toStringImpl(ToStringContext) const { return "ulong[]"; } override int compare(in void* p1, in void* p2) const { diff --git a/src/rt/typeinfo/ti_Areal.d b/src/rt/typeinfo/ti_Areal.d index 5280f81fe6..7ea6373826 100644 --- a/src/rt/typeinfo/ti_Areal.d +++ b/src/rt/typeinfo/ti_Areal.d @@ -23,7 +23,7 @@ class TypeInfo_Ae : TypeInfo_Array override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return (F[]).stringof; } + override string toStringImpl(ToStringContext) const { return (F[]).stringof; } override size_t getHash(scope const void* p) @trusted const { @@ -52,7 +52,7 @@ class TypeInfo_Aj : TypeInfo_Ae { alias F = ireal; - override string toString() const { return (F[]).stringof; } + override string toStringImpl(ToStringContext) const { return (F[]).stringof; } override @property inout(TypeInfo) next() inout { diff --git a/src/rt/typeinfo/ti_Ashort.d b/src/rt/typeinfo/ti_Ashort.d index aea4be7704..c05eb3b9e7 100644 --- a/src/rt/typeinfo/ti_Ashort.d +++ b/src/rt/typeinfo/ti_Ashort.d @@ -21,7 +21,7 @@ class TypeInfo_As : TypeInfo_Array { override bool opEquals(Object o) { return TypeInfo.opEquals(o); } - override string toString() const { return "short[]"; } + override string toStringImpl(ToStringContext) const { return "short[]"; } override size_t getHash(scope const void* p) @trusted const { @@ -71,7 +71,7 @@ class TypeInfo_As : TypeInfo_Array class TypeInfo_At : TypeInfo_As { - override string toString() const { return "ushort[]"; } + override string toStringImpl(ToStringContext) const { return "ushort[]"; } override int compare(in void* p1, in void* p2) const { @@ -104,7 +104,7 @@ class TypeInfo_At : TypeInfo_As class TypeInfo_Au : TypeInfo_At { - override string toString() const { return "wchar[]"; } + override string toStringImpl(ToStringContext) const { return "wchar[]"; } override @property inout(TypeInfo) next() inout { diff --git a/src/rt/typeinfo/ti_byte.d b/src/rt/typeinfo/ti_byte.d index 2cc3f98388..72c0677c23 100644 --- a/src/rt/typeinfo/ti_byte.d +++ b/src/rt/typeinfo/ti_byte.d @@ -22,7 +22,7 @@ class TypeInfo_g : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "byte"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "byte"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_cdouble.d b/src/rt/typeinfo/ti_cdouble.d index 939edda579..cdf949482e 100644 --- a/src/rt/typeinfo/ti_cdouble.d +++ b/src/rt/typeinfo/ti_cdouble.d @@ -25,7 +25,7 @@ class TypeInfo_r : TypeInfo alias F = cdouble; - override string toString() const { return F.stringof; } + override string toStringImpl(ToStringContext) const { return F.stringof; } override size_t getHash(scope const void* p) const @trusted { diff --git a/src/rt/typeinfo/ti_cfloat.d b/src/rt/typeinfo/ti_cfloat.d index 6c856310d6..2c28d53e91 100644 --- a/src/rt/typeinfo/ti_cfloat.d +++ b/src/rt/typeinfo/ti_cfloat.d @@ -25,7 +25,7 @@ class TypeInfo_q : TypeInfo alias F = cfloat; - override string toString() const { return F.stringof; } + override string toStringImpl(ToStringContext) const { return F.stringof; } override size_t getHash(scope const void* p) const @trusted { diff --git a/src/rt/typeinfo/ti_char.d b/src/rt/typeinfo/ti_char.d index c804711af2..ee7ac31cf5 100644 --- a/src/rt/typeinfo/ti_char.d +++ b/src/rt/typeinfo/ti_char.d @@ -22,7 +22,7 @@ class TypeInfo_a : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "char"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "char"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_creal.d b/src/rt/typeinfo/ti_creal.d index 5ed045d1ac..d1351c2f44 100644 --- a/src/rt/typeinfo/ti_creal.d +++ b/src/rt/typeinfo/ti_creal.d @@ -25,7 +25,7 @@ class TypeInfo_c : TypeInfo alias F = creal; - override string toString() const { return F.stringof; } + override string toStringImpl(ToStringContext) const { return F.stringof; } override size_t getHash(scope const void* p) const @trusted { diff --git a/src/rt/typeinfo/ti_dchar.d b/src/rt/typeinfo/ti_dchar.d index 0051dfc4ac..49293d851e 100644 --- a/src/rt/typeinfo/ti_dchar.d +++ b/src/rt/typeinfo/ti_dchar.d @@ -22,7 +22,7 @@ class TypeInfo_w : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "dchar"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "dchar"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_double.d b/src/rt/typeinfo/ti_double.d index f9a95a6fff..d0cecf20cf 100644 --- a/src/rt/typeinfo/ti_double.d +++ b/src/rt/typeinfo/ti_double.d @@ -25,7 +25,7 @@ class TypeInfo_d : TypeInfo alias F = double; - override string toString() const { return F.stringof; } + override string toStringImpl(ToStringContext) const { return F.stringof; } override size_t getHash(scope const void* p) const @trusted { diff --git a/src/rt/typeinfo/ti_float.d b/src/rt/typeinfo/ti_float.d index 790d759fc0..1b534747ea 100644 --- a/src/rt/typeinfo/ti_float.d +++ b/src/rt/typeinfo/ti_float.d @@ -25,7 +25,7 @@ class TypeInfo_f : TypeInfo alias F = float; - override string toString() const { return F.stringof; } + override string toStringImpl(ToStringContext) const { return F.stringof; } override size_t getHash(scope const void* p) const @trusted { diff --git a/src/rt/typeinfo/ti_idouble.d b/src/rt/typeinfo/ti_idouble.d index 9820cabec8..00b4f232e5 100644 --- a/src/rt/typeinfo/ti_idouble.d +++ b/src/rt/typeinfo/ti_idouble.d @@ -23,5 +23,5 @@ class TypeInfo_p : TypeInfo_d nothrow: @safe: - override string toString() const { return idouble.stringof; } + override string toStringImpl(ToStringContext) const { return idouble.stringof; } } diff --git a/src/rt/typeinfo/ti_ifloat.d b/src/rt/typeinfo/ti_ifloat.d index c16358522b..9928046a33 100644 --- a/src/rt/typeinfo/ti_ifloat.d +++ b/src/rt/typeinfo/ti_ifloat.d @@ -23,5 +23,5 @@ class TypeInfo_o : TypeInfo_f nothrow: @safe: - override string toString() const { return ifloat.stringof; } + override string toStringImpl(ToStringContext) const { return ifloat.stringof; } } diff --git a/src/rt/typeinfo/ti_int.d b/src/rt/typeinfo/ti_int.d index a4c47d3af6..28dc0b1793 100644 --- a/src/rt/typeinfo/ti_int.d +++ b/src/rt/typeinfo/ti_int.d @@ -22,7 +22,7 @@ class TypeInfo_i : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "int"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "int"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_ireal.d b/src/rt/typeinfo/ti_ireal.d index 6d7dd18e4f..5ed99826ba 100644 --- a/src/rt/typeinfo/ti_ireal.d +++ b/src/rt/typeinfo/ti_ireal.d @@ -23,5 +23,5 @@ class TypeInfo_j : TypeInfo_e nothrow: @safe: - override string toString() const { return ireal.stringof; } + override string toStringImpl(ToStringContext) const { return ireal.stringof; } } diff --git a/src/rt/typeinfo/ti_long.d b/src/rt/typeinfo/ti_long.d index 3f8ba8e655..1830d8ffbd 100644 --- a/src/rt/typeinfo/ti_long.d +++ b/src/rt/typeinfo/ti_long.d @@ -22,7 +22,7 @@ class TypeInfo_l : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "long"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "long"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_n.d b/src/rt/typeinfo/ti_n.d index 13f3acf7b9..9be1249bd5 100644 --- a/src/rt/typeinfo/ti_n.d +++ b/src/rt/typeinfo/ti_n.d @@ -17,7 +17,7 @@ module rt.typeinfo.ti_n; class TypeInfo_n : TypeInfo { - override string toString() const @safe { return "typeof(null)"; } + override string toStringImpl(ToStringContext) const @safe { return "typeof(null)"; } override size_t getHash(scope const void* p) const { diff --git a/src/rt/typeinfo/ti_real.d b/src/rt/typeinfo/ti_real.d index 6ca240caeb..b90038722b 100644 --- a/src/rt/typeinfo/ti_real.d +++ b/src/rt/typeinfo/ti_real.d @@ -25,7 +25,7 @@ class TypeInfo_e : TypeInfo alias F = real; - override string toString() const { return F.stringof; } + override string toStringImpl(ToStringContext) const { return F.stringof; } override size_t getHash(scope const void* p) const @trusted { diff --git a/src/rt/typeinfo/ti_short.d b/src/rt/typeinfo/ti_short.d index da445c2744..bdf8ec1413 100644 --- a/src/rt/typeinfo/ti_short.d +++ b/src/rt/typeinfo/ti_short.d @@ -22,7 +22,7 @@ class TypeInfo_s : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "short"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "short"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_ubyte.d b/src/rt/typeinfo/ti_ubyte.d index 09232fd1c3..c94d6e43dc 100644 --- a/src/rt/typeinfo/ti_ubyte.d +++ b/src/rt/typeinfo/ti_ubyte.d @@ -22,7 +22,7 @@ class TypeInfo_h : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "ubyte"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "ubyte"; } override size_t getHash(scope const void* p) { @@ -66,5 +66,5 @@ class TypeInfo_b : TypeInfo_h pure: nothrow: - override string toString() const pure nothrow @safe { return "bool"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "bool"; } } diff --git a/src/rt/typeinfo/ti_uint.d b/src/rt/typeinfo/ti_uint.d index 8f8e42fa91..73ef181db6 100644 --- a/src/rt/typeinfo/ti_uint.d +++ b/src/rt/typeinfo/ti_uint.d @@ -22,7 +22,7 @@ class TypeInfo_k : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "uint"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "uint"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_ulong.d b/src/rt/typeinfo/ti_ulong.d index 7382e487ad..6eb44b4637 100644 --- a/src/rt/typeinfo/ti_ulong.d +++ b/src/rt/typeinfo/ti_ulong.d @@ -23,7 +23,7 @@ class TypeInfo_m : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "ulong"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "ulong"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_ushort.d b/src/rt/typeinfo/ti_ushort.d index 3a95eb4646..5c0004adf7 100644 --- a/src/rt/typeinfo/ti_ushort.d +++ b/src/rt/typeinfo/ti_ushort.d @@ -22,7 +22,7 @@ class TypeInfo_t : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "ushort"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "ushort"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_void.d b/src/rt/typeinfo/ti_void.d index c35de7b88d..5bd68ab82a 100644 --- a/src/rt/typeinfo/ti_void.d +++ b/src/rt/typeinfo/ti_void.d @@ -22,7 +22,7 @@ class TypeInfo_v : TypeInfo pure: nothrow: - override string toString() const pure nothrow @safe { return "void"; } + override string toStringImpl(ToStringContext) const pure nothrow @safe { return "void"; } override size_t getHash(scope const void* p) { diff --git a/src/rt/typeinfo/ti_wchar.d b/src/rt/typeinfo/ti_wchar.d index a1ba04196f..4e76d34b37 100644 --- a/src/rt/typeinfo/ti_wchar.d +++ b/src/rt/typeinfo/ti_wchar.d @@ -22,7 +22,7 @@ class TypeInfo_u : TypeInfo pure: nothrow: - override string toString() { return "wchar"; } + override string toStringImpl(ToStringContext) { return "wchar"; } override size_t getHash(scope const void* p) {