Bug 23473 – Need a way to disassemble an overload function without referencing a parent

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-11-10T11:56:56Z
Last change time
2024-12-13T19:25:36Z
Keywords
industry
Assigned to
No Owner
Creator
FeepingCreature
Moved to GitHub: dmd#18134 →

Comments

Comment #0 by default_357-line — 2022-11-10T11:56:56Z
Comment #1 by default_357-line — 2022-11-10T11:58:26Z
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.
Comment #2 by dlang-bot — 2022-11-10T13:18:19Z
@FeepingCreature created dlang/dmd pull request #14631 "Issue 23473: Improvement: Implement single-argument __traits(getOverloads) form." mentioning this issue: - Issue 23473: Improvement: Implement single-argument __traits(getOverloads) form. https://github.com/dlang/dmd/pull/14631
Comment #3 by robert.schadek — 2024-12-13T19:25:36Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18134 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB