Issue 9136 - Add isNested trait for aggregates and functions#1362
Issue 9136 - Add isNested trait for aggregates and functions#1362MartinNowak merged 1 commit intomasterfrom unknown repository
Conversation
|
Seems reasonable to me. |
|
@9rnsr: If you find any gotchas -- it would be great to know so we can make this trait reliable from the get-go. |
|
All test codes for |
|
LGTM. |
|
@AndrejMitrovic: Indeed. For nested class type, checking |
Thanks, I was wondering where to put the testcase. Will update soon. |
|
Note: I've changed the implementation (sorry to reviewer Kenji). It was necessary to disallow invalid argument count, and invalid checks like e.g. |
|
I've rebased this again, after the tester is green we should try merging it. |
|
LGTM, but I would prefer to see a merged spec update first. |
|
I'll make the spec pull. Also I'm going to add another test-case which was missed: static class A { static class SC { } class NC { } }
static assert(!__traits(isNested, A));
static assert(!__traits(isNested, A.SC));
static assert(__traits(isNested, A.NC)); |
So this already works for classes, great. |
Issue 9136 - Add isNested trait for aggregates and functions
|
Updated |
http://d.puremagic.com/issues/show_bug.cgi?id=9136
This adds a new trait:
__traits(isNested, T), which is true for type T if it's a nested type which holds a context pointer (aggregate or function).Current library workarounds require using
.stringoftricks, which probably isn't very reliable. This pull simplifies implementation of Phobos Pull 948.I'll add a documentation pull if & after this pull is merged.