https://issues.dlang.org/show_bug.cgi?id=23473

--- Comment #1 from FeepingCreature <default_357-l...@yahoo.de> ---
Oops, pressed return too soon.

Consider this code:

--- b.d
void first(int) { }
--- a.d
import b : foo = first;
import c : foo = second;

void main() {
    foo(1); // works
    foo("hello"); // works
    alias overloads = __traits(getOverloads, __traits(parent, foo),
__traits(identifier, foo));
    static assert(overloads.length == 2);
}
--- c.d
void second(string) { }

Because the overload we want is not of a struct or class, we use the common
pattern, for example used in https://dlang.org/blog/category/algorithms/ , to
get "the module" the overload is in. But there is no such module, because the
overload is formed from two other modules that don't even use the same
identifier for it.

There should be an overload or trait alternative to getOverloads that operates
on a symbol directly.

--

Reply via email to