diff options
Diffstat (limited to 'dev-lang/dmd/files/2.059-issue-7907.patch')
-rw-r--r-- | dev-lang/dmd/files/2.059-issue-7907.patch | 346 |
1 files changed, 0 insertions, 346 deletions
diff --git a/dev-lang/dmd/files/2.059-issue-7907.patch b/dev-lang/dmd/files/2.059-issue-7907.patch deleted file mode 100644 index e04d226e1..000000000 --- a/dev-lang/dmd/files/2.059-issue-7907.patch +++ /dev/null @@ -1,346 +0,0 @@ -diff -Nurp a/src/phobos/std/conv.d b/src/phobos/std/conv.d ---- a/src/phobos/std/conv.d 2012-04-17 12:02:10.824875716 +0200 -+++ b/src/phobos/std/conv.d 2012-04-17 12:15:10.654126508 +0200 -@@ -101,6 +101,12 @@ private - formatValue(w, src, f); - return w.data; - } -+ -+ template isEnumStrToStr(S, T) // @@@Workaround@@@ -+ { -+ enum isEnumStrToStr = isImplicitlyConvertible!(S, T) && -+ is(S == enum) && isSomeString!T; -+ } - } - - /** -@@ -250,7 +256,7 @@ If the source type is implicitly convert - to) simply performs the implicit conversion. - */ - T toImpl(T, S)(S value) -- if (isImplicitlyConvertible!(S, T)) -+ if (isImplicitlyConvertible!(S, T) && !isEnumStrToStr!(S, T)) - { - alias isUnsigned isUnsignedInt; - -@@ -1032,8 +1038,7 @@ unittest - - /// ditto - T toImpl(T, S)(S s) -- if (!isImplicitlyConvertible!(S, T) && -- is(S == enum) && -+ if (is(S == enum) && - isSomeString!T) - { - return toStr!T(s); -@@ -1042,21 +1047,26 @@ T toImpl(T, S)(S s) - unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -- enum E { a, b, c } -- assert(to! string(E.a) == "a"c); -- assert(to!wstring(E.b) == "b"w); -- assert(to!dstring(E.c) == "c"d); -- -- enum F : real { x = 1.414, y = 1.732, z = 2.236 } -- assert(to! string(F.x) == "x"c); -- assert(to!wstring(F.y) == "y"w); -- assert(to!dstring(F.z) == "z"d); -+ -+ enum EB { a = true } -+ enum EU { a = 0, b = 1, c = 2 } // base type is unsigned -+ enum EI { a = -1, b = 0, c = 1 } // base type is signed (bug 7909) -+ enum EF : real { a = 1.414, b = 1.732, c = 2.236 } -+ enum EC { a = 'a', b = 'b' } -+ enum ES : string { a = "aaa", b = "bbb" } -+ -+ foreach (E; TypeTuple!(EB, EU, EI, EF, EC, ES)) -+ { -+ assert(to! string(E.a) == "a"c); -+ assert(to!wstring(E.a) == "a"w); -+ assert(to!dstring(E.a) == "a"d); -+ } - - // Test an value not corresponding to an enum member. -- auto o = cast(E)5; -- assert(to! string(o) == "cast(E)5"c); -- assert(to!wstring(o) == "cast(E)5"w); -- assert(to!dstring(o) == "cast(E)5"d); -+ auto o = cast(EU)5; -+ assert(to! string(o) == "cast(EU)5"c); -+ assert(to!wstring(o) == "cast(EU)5"w); -+ assert(to!dstring(o) == "cast(EU)5"d); - } - - /// ditto -@@ -1073,7 +1083,7 @@ deprecated T toImpl(T, S)(S s, in T left - - /// ditto - T toImpl(T, S)(S b) -- if (is(Unqual!S == bool) && -+ if (isBoolean!S && - isSomeString!T) - { - return toStr!T(b); -@@ -1090,7 +1100,7 @@ unittest - - /// ditto - T toImpl(T, S)(S c) -- if (isSomeChar!(Unqual!S) && -+ if (isSomeChar!S && - isSomeString!T) - { - return toStr!T(c); -@@ -1132,7 +1142,7 @@ unittest - - /// ditto - T toImpl(T, S)(S input) -- if (isIntegral!S && isUnsigned!S && -+ if (isIntegral!S && - isSomeString!T) - { - return toStr!T(input); -@@ -1149,26 +1159,7 @@ unittest - assert(to!string(to!Int(9)) == "9"); - assert(to!string(to!Int(123)) == "123"); - } --} -- --/// ditto --T toImpl(T, S)(S value) -- if (isIntegral!S && isSigned!S && -- isSomeString!T) --{ -- return toStr!T(value); --} - --unittest --{ -- debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -- assert(wtext(int.max) == "2147483647"w); -- assert(wtext(int.min) == "-2147483648"w); -- assert(to!string(0L) == "0"); --} -- --unittest --{ - foreach (Int; TypeTuple!(byte, short, int, long)) - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -@@ -1184,9 +1175,17 @@ unittest - } - } - -+unittest -+{ -+ debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -+ assert(wtext(int.max) == "2147483647"w); -+ assert(wtext(int.min) == "-2147483648"w); -+ assert(to!string(0L) == "0"); -+} -+ - /// ditto - T toImpl(T, S)(S value, uint radix) -- if (isIntegral!(Unqual!S) && -+ if (isIntegral!S && - isSomeString!T) - in - { -@@ -1194,7 +1193,7 @@ in - } - body - { -- static if (!is(Unqual!S == ulong)) -+ static if (!is(IntegralTypeOf!S == ulong)) - { - enforce(radix >= 2 && radix <= 36, new ConvException("Radix error")); - if (radix == 10) -@@ -2076,24 +2075,25 @@ Target parse(Target, Source)(ref Source - ~ to!string(s) ~ "'"); - } - --//@@@BUG4737@@@: typeid doesn't work for scoped enum with initializer --version(unittest) --{ -- private enum F : real { x = 1.414, y = 1.732, z = 2.236 } --} - unittest - { - debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded."); -- enum E { a, b, c } -- assert(to!E("a"c) == E.a); -- assert(to!E("b"w) == E.b); -- assert(to!E("c"d) == E.c); - -- assert(to!F("x"c) == F.x); -- assert(to!F("y"w) == F.y); -- assert(to!F("z"d) == F.z); -+ enum EB : bool { a = true, b = false, c = a } -+ enum EU { a, b, c } -+ enum EI { a = -1, b = 0, c = 1 } -+ enum EF : real { a = 1.414, b = 1.732, c = 2.236 } -+ enum EC : char { a = 'a', b = 'b', c = 'c' } -+ enum ES : string { a = "aaa", b = "bbb", c = "ccc" } -+ -+ foreach (E; TypeTuple!(EB, EU, EI, EF, EC, ES)) -+ { -+ assert(to!E("a"c) == E.a); -+ assert(to!E("b"w) == E.b); -+ assert(to!E("c"d) == E.c); - -- assertThrown!ConvException(to!E("d")); -+ assertThrown!ConvException(to!E("d")); -+ } - } - - version (none) // TODO: BUG4744 -diff -Nurp a/src/phobos/std/stdio.d b/src/phobos/std/stdio.d ---- a/src/phobos/std/stdio.d 2012-04-17 12:02:10.957874054 +0200 -+++ b/src/phobos/std/stdio.d 2012-04-17 12:15:10.648126586 +0200 -@@ -665,19 +665,19 @@ arguments in text format to the file. */ - foreach (arg; args) - { - alias typeof(arg) A; -- static if (isSomeString!A && !is(A == enum)) -+ static if (isSomeString!A) - { - put(w, arg); - } -- else static if (isIntegral!A && !is(A == enum)) -+ else static if (isIntegral!A) - { - toTextRange(arg, w); - } -- else static if (isBoolean!A && !is(A == enum)) -+ else static if (isBoolean!A) - { - put(w, arg ? "true" : "false"); - } -- else static if (isSomeChar!A && !is(A == enum)) -+ else static if (isSomeChar!A) - { - put(w, arg); - } -diff -Nurp a/src/phobos/std/traits.d b/src/phobos/std/traits.d ---- a/src/phobos/std/traits.d 2012-04-17 12:02:10.897874804 +0200 -+++ b/src/phobos/std/traits.d 2012-04-17 12:15:10.647126599 +0200 -@@ -2693,7 +2693,7 @@ unittest - - /* - */ --template BooleanTypeOf(T) -+template BooleanTypeOf(T) if (!is(T == enum)) - { - inout(bool) idx( inout(bool) ); - shared(inout bool) idx( shared(inout bool) ); -@@ -2727,7 +2727,7 @@ unittest - - /* - */ --template IntegralTypeOf(T) -+template IntegralTypeOf(T) if (!is(T == enum)) - { - inout( byte) idx( inout( byte) ); - inout( ubyte) idx( inout( ubyte) ); -@@ -2786,7 +2786,7 @@ unittest - - /* - */ --template FloatingPointTypeOf(T) -+template FloatingPointTypeOf(T) if (!is(T == enum)) - { - inout( float) idx( inout( float) ); - inout(double) idx( inout(double) ); -@@ -2825,7 +2825,7 @@ unittest - - /* - */ --template NumericTypeOf(T) -+template NumericTypeOf(T) if (!is(T == enum)) - { - static if (is(IntegralTypeOf!T X)) - alias X NumericTypeOf; -@@ -2853,7 +2853,7 @@ unittest - - /* - */ --template UnsignedTypeOf(T) -+template UnsignedTypeOf(T) if (!is(T == enum)) - { - static if (is(IntegralTypeOf!T X) && - staticIndexOf!(Unqual!X, UnsignedIntTypeList) >= 0) -@@ -2862,7 +2862,7 @@ template UnsignedTypeOf(T) - static assert(0, T.stringof~" is not an unsigned type."); - } - --template SignedTypeOf(T) -+template SignedTypeOf(T) if (!is(T == enum)) - { - static if (is(IntegralTypeOf!T X) && - staticIndexOf!(Unqual!X, SignedIntTypeList) >= 0) -@@ -2875,7 +2875,7 @@ template SignedTypeOf(T) - - /* - */ --template CharTypeOf(T) -+template CharTypeOf(T) if (!is(T == enum)) - { - inout( char) idx( inout( char) ); - inout(wchar) idx( inout(wchar) ); -@@ -2930,7 +2930,7 @@ unittest - - /* - */ --template StaticArrayTypeOf(T) -+template StaticArrayTypeOf(T) if (!is(T == enum)) - { - inout(U[n]) idx(U, size_t n)( inout(U[n]) ); - -@@ -2961,7 +2961,7 @@ unittest - - /* - */ --template DynamicArrayTypeOf(T) -+template DynamicArrayTypeOf(T) if (!is(T == enum)) - { - inout(U[]) idx(U)( inout(U[]) ); - -@@ -3001,7 +3001,7 @@ unittest - - /* - */ --template ArrayTypeOf(T) -+template ArrayTypeOf(T) if (!is(T == enum)) - { - static if (is(StaticArrayTypeOf!T X)) - alias X ArrayTypeOf; -@@ -3017,7 +3017,7 @@ unittest - - /* - */ --template StringTypeOf(T) if (isSomeString!T) -+template StringTypeOf(T) if (!is(T == enum) && isSomeString!T) - { - alias ArrayTypeOf!T StringTypeOf; - } -@@ -3047,7 +3047,7 @@ unittest - - /* - */ --template AssocArrayTypeOf(T) -+template AssocArrayTypeOf(T) if (!is(T == enum)) - { - immutable(V [K]) idx(K, V)( immutable(V [K]) ); - -@@ -3279,7 +3279,10 @@ Detect whether we can treat T as one of - */ - template isSomeString(T) - { -- enum isSomeString = isNarrowString!T || is(T : const(dchar[])); -+ static if (is(T == enum)) -+ enum isSomeString = false; -+ else -+ enum isSomeString = isNarrowString!T || is(T : const(dchar[])); - } - - unittest |