Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "std.traits: Adapt unittest to pass with -preview=in" #7611

Merged
merged 1 commit into from
Aug 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 7 additions & 22 deletions std/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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));
}


Expand Down