Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 13, 2019 [Issue 18947] No way to get list of overloads from template mixins | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18947 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |b2.temp@gmx.com Hardware|x86 |All Resolution|--- |INVALID OS|Windows |All --- Comment #1 from Basile-z <b2.temp@gmx.com> --- Mixed declarations are put in a nested scope. To get the overload set it's possible to use aliases to this nested scopes: mixin template foo(T) { void fun(T) {} } struct S { mixin foo!int o1; mixin foo!string o2; alias fun = o1.fun; alias fun = o2.fun; } unittest { static assert(__traits(getOverloads, S, "fun").length == 2); } see point 5 of https://dlang.org/spec/template-mixin.html#mixin_scope -- |
February 13, 2019 [Issue 18947] No way to get list of overloads from template mixins | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18947 Simen Kjaeraas <simen.kjaras@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID |--- --- Comment #2 from Simen Kjaeraas <simen.kjaras@gmail.com> --- Your solution requires me to change the type to get information that is already available to the compiler elsewhere. To top it off, the behavior is inconsistent: mixin template foo(T) { static int fun(T) { return 0; } } struct S1 { mixin foo!int; } unittest { alias a = __traits(getMember, S1, "fun"); a(1); // Works fine // Can get overloads when there's only one: static assert(__traits(getOverloads, S1, "fun").length == 1); } struct S2 { mixin foo!int; mixin foo!string; } unittest { __traits(getMember, S2, "fun")(2); // Works fine __traits(getMember, S2, "fun")(""); // Works fine alias a = __traits(getMember, S2, "fun"); a(2); // Error: function expected before (), not void of type void a(""); // Error: function expected before (), not void of type void } struct S3 { static int fun(int) { return 0; } static int fun(string) { return 0; } } unittest { alias a = __traits(getMember, S3, "fun"); a(3); // Works fine a(""); // Works fine } -- |
March 21, 2020 [Issue 18947] No way to get list of overloads from template mixins | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18947 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|b2.temp@gmx.com | -- |
December 17, 2022 [Issue 18947] No way to get list of overloads from template mixins | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18947 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation