Bug 17110 – Proxy (and therefore Typedef) doesn't work for type alias members

Status
NEW
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-01-20T10:47:06Z
Last change time
2024-12-01T16:29:24Z
Assigned to
No Owner
Creator
John Colvin
Moved to GitHub: phobos#10232 →

Comments

Comment #0 by john.loughran.colvin — 2017-01-20T10:47:06Z
We get away with it for enums with CTFE of opDispatch but it's no good for types etc. Here's a reasonably large unittest, now someone just needs to fix the implementation so it passes: version(unittest) { private int __global_n; } unittest { import std.typecons : Typedef; import std.meta : AliasSeq; int n; struct S { alias X = int; alias Y() = int; alias Z(Q) = Q; alias A = AliasSeq!(n, float); alias B() = AliasSeq!(n, float); alias C(e...) = AliasSeq!(e, float); alias AS(Args ...) = AliasSeq!Args; } //alias TS = S; //for testing the tests without Typedef alias TS = Typedef!S; TS.X x; static assert(is(typeof(x) == int)); TS.Y!() y; static assert(is(typeof(y) == int)); TS.Z!int z; static assert(is(typeof(z) == int)); alias a = TS.A; a[0] = 3; assert(n == 3); static assert(is(a[1] == float)); alias b = TS.B!(); b[0] = 4; assert(n == 4); static assert(is(b[1] == float)); alias c = TS.C!__global_n; assert(__global_n == 4); static assert(is(c[1] == float)); alias AS = TS.AS; alias L = AS!(__global_n, int, 4); alias R = AliasSeq!(__global_n, int, 4); assert(L[0] is R[0]); assert(is(L[1] == R[1])); assert(L[2] == R[2]); }
Comment #1 by robert.schadek — 2024-12-01T16:29:24Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10232 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB