Skip to content

Commit

Permalink
Revert "Merge pull request #4747 from MartinNowak/fix15907"
Browse files Browse the repository at this point in the history
This reverts commit d10780f, reversing
changes made to 01eb06b.
  • Loading branch information
MartinNowak committed Sep 12, 2016
1 parent d10780f commit a2c0a90
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 38 deletions.
2 changes: 1 addition & 1 deletion posix.mak
Expand Up @@ -210,7 +210,7 @@ EXTRA_MODULES_INTERNAL := $(addprefix \
gammafunction errorfunction) $(addprefix std/internal/, \
cstring processinit unicode_tables scopebuffer\
unicode_comp unicode_decomp unicode_grapheme unicode_norm) \
$(addprefix std/internal/test/, dummyrange uda) \
$(addprefix std/internal/test/, dummyrange) \
$(addprefix std/experimental/ndslice/, internal) \
$(addprefix std/algorithm/, internal)

Expand Down
10 changes: 0 additions & 10 deletions std/internal/test/uda.d
Expand Up @@ -14,13 +14,3 @@ struct HasPrivateMembers
@Attr private int c;
private int d;
}

// If getSymbolsByUDA is mixed into the same scope it also returns private members
unittest
{
import std.traits : getSymbolsByUDA, hasUDA;
mixin getSymbolsByUDA!(HasPrivateMembers, Attr) symbols;
static assert(symbols.getSymbolsByUDA.length == 2);
static assert(hasUDA!(symbols.getSymbolsByUDA[0], Attr));
static assert(hasUDA!(symbols.getSymbolsByUDA[1], Attr));
}
29 changes: 3 additions & 26 deletions std/traits.d
Expand Up @@ -6798,37 +6798,14 @@ unittest
static assert(getSymbolsByUDA!(C, UDA)[1].stringof == "d");
}

/// mixin getSymbolsByUDA to also find private members
unittest
{
import std.traits;
enum UDA;
struct S
{
@UDA int visible;
@UDA private int invisible;
}
// mixin the template instantiation, using a name to avoid namespace pollution
mixin getSymbolsByUDA!(S, UDA) symbols;
// as the template is instantiated in the current scope, it can see private members
// mixin templates don't perform eponymous expansion, so an additional `.getSymbolsByUDA` is needed
static assert(symbols.getSymbolsByUDA.length == 2);
}

// #15335: getSymbolsByUDA fails if type has private members
unittest
{
// HasPrivateMembers has private members, but only the ones visible from std.traits are returned
// HasPrivateMembers has, well, private members, one of which has a UDA.
import std.internal.test.uda;
// whether allMembers returns private members, see dmd fix for Issue 15907
static if (__traits(allMembers, HasPrivateMembers).length == 2)
static assert(getSymbolsByUDA!(HasPrivateMembers, Attr).length == 1);
else
{
static assert(getSymbolsByUDA!(HasPrivateMembers, Attr).length == 2);
static assert(hasUDA!(getSymbolsByUDA!(HasPrivateMembers, Attr)[1], Attr));
}
static assert(getSymbolsByUDA!(HasPrivateMembers, Attr).length == 2);
static assert(hasUDA!(getSymbolsByUDA!(HasPrivateMembers, Attr)[0], Attr));
static assert(hasUDA!(getSymbolsByUDA!(HasPrivateMembers, Attr)[1], Attr));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion win32.mak
Expand Up @@ -238,7 +238,7 @@ SRC_STD_C_FREEBSD= std\c\freebsd\socket.d
SRC_STD_INTERNAL= std\internal\cstring.d std\internal\processinit.d \
std\internal\unicode_tables.d std\internal\unicode_comp.d std\internal\unicode_decomp.d \
std\internal\unicode_grapheme.d std\internal\unicode_norm.d std\internal\scopebuffer.d \
std\internal\test\dummyrange.d std\internal\test\uda.d
std\internal\test\dummyrange.d

SRC_STD_INTERNAL_DIGEST= std\internal\digest\sha_SSSE3.d

Expand Down

0 comments on commit a2c0a90

Please sign in to comment.