Bug 11711 – Add __traits(getAliasThis)

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-07T23:15:00Z
Last change time
2014-01-08T01:46:45Z
Keywords
pull
Assigned to
nobody
Creator
k.hara.pg
Blocks
6930

Comments

Comment #0 by k.hara.pg — 2013-12-07T23:15:46Z
Currently, std.traits.XXXTypeOf is implemented in tricky. To fix the complexity, I'd like to propose a new __trait. alias Seq(T...) = T; alias TypeTuple = Seq; import std.typetuple; struct S1 { string var; alias var this; } static assert(__traits(getAliasThis, S1) == TypeTuple!("var")); // __traits(getAliasThis) returns a tuple of alias this member names static assert(is(typeof(__traits(getMember, S1.init, __traits(getAliasThis, S1)[0])) == string)); // Extract the alias this type by using the combination with __traits(getMember). struct S2 { TypeTuple!(int, string) var; alias var this; } static assert(__traits(getAliasThis, S2) == TypeTuple!("var")); static assert(is(typeof(__traits(getMember, S2.init, __traits(getAliasThis, S2)[0])) == TypeTuple!(int, string)));
Comment #1 by k.hara.pg — 2013-12-09T01:09:59Z
Comment #2 by github-bugzilla — 2013-12-15T14:00:57Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/eee9e4e231aa0cac617da4ff3b19173f0eab4e22 fix Issue 11711 - Add __traits(getAliasThis) https://github.com/D-Programming-Language/dmd/commit/06ff681ccd784c9729b21b96a695dce9c4f51809 Merge pull request #2939 from 9rnsr/fix11711 Issue 11711 - Add __traits(getAliasThis)
Comment #3 by github-bugzilla — 2013-12-15T22:59:31Z
Comment #4 by github-bugzilla — 2013-12-19T05:47:39Z
Comment #5 by github-bugzilla — 2014-01-08T01:46:45Z