From 1af4e48c4e60da782042176836d953a701b28690 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Sun, 30 Aug 2020 11:07:05 +0200 Subject: [PATCH] Revert "std.traits: Adapt unittest to pass with `-preview=in` (#7609)" This reverts commit aca1e1208fc7f914b44e44f07bee836c7eeb941a. --- std/traits.d | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/std/traits.d b/std/traits.d index 7d45099982a..11e160ce75a 100644 --- a/std/traits.d +++ b/std/traits.d @@ -5180,10 +5180,10 @@ enum isAssignable(Lhs, Rhs = Lhs) = isRvalueAssignable!(Lhs, Rhs) && isLvalueAss } // ditto -private enum isRvalueAssignable(Lhs, Rhs = Lhs) = __traits(compiles, { lvalueOf!Lhs = rvalueOf!Rhs; }); +private enum isRvalueAssignable(Lhs, Rhs = Lhs) = __traits(compiles, lvalueOf!Lhs = rvalueOf!Rhs); // ditto -private enum isLvalueAssignable(Lhs, Rhs = Lhs) = __traits(compiles, { lvalueOf!Lhs = lvalueOf!Rhs; }); +private enum isLvalueAssignable(Lhs, Rhs = Lhs) = __traits(compiles, lvalueOf!Lhs = lvalueOf!Rhs); @safe unittest { @@ -5219,26 +5219,11 @@ private enum isLvalueAssignable(Lhs, Rhs = Lhs) = __traits(compiles, { lvalueOf! static assert( isAssignable!(S4, immutable int)); struct S5 { @disable this(); @disable this(this); } - - // `-preview=in` is enabled - static if (!is(typeof(mixin(q{(in ref int a) => a})))) - { - struct S6 { void opAssign(in S5); } - - static assert(isRvalueAssignable!(S6, S5)); - static assert(isLvalueAssignable!(S6, S5)); - static assert(isAssignable!(S6, S5)); - static assert(isAssignable!(S6, immutable S5)); - } - else - { - mixin(q{ struct S6 { void opAssign(in ref S5); } }); - - static assert(!isRvalueAssignable!(S6, S5)); - static assert( isLvalueAssignable!(S6, S5)); - static assert(!isAssignable!(S6, S5)); - static assert( isLvalueAssignable!(S6, immutable S5)); - } + struct S6 { void opAssign(in ref S5); } + static assert(!isAssignable!(S6, S5)); + static assert(!isRvalueAssignable!(S6, S5)); + static assert( isLvalueAssignable!(S6, S5)); + static assert( isLvalueAssignable!(S6, immutable S5)); }