Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoImplement self and parent aliases are incorrect for overloaded functions #10367

Open
dlangBugzillaToGithub opened this issue Mar 3, 2019 · 2 comments

Comments

@dlangBugzillaToGithub
Copy link

htvennik reported this on 2019-03-03T16:59:11Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=19715

Description

The aliases `self` and `parent` are both declared by aliasing the function by name. For overloaded functions this means the overloads is aliased, not the exact function being implemented. This is not a problem when just calling `self` or `parent`, but for reflection purposes it is.

The following should work, but doesn't:

----------
import std.typecons : AutoImplement;

interface A
{
	void overloaded(int);
	void overloaded(float);
}

enum tpl(C, alias fun) = q{
	import std.traits : Parameters;
	static assert(is(Parameters!self == typeof(args)));
};

alias Impl = AutoImplement!(A, tpl);
----------

Output:

$ dmd -o- -c autoimplement.d
/Library/D/dmd/src/phobos/std/typecons.d-mixin-4495(4510): Error: static assert:  is((int) == (float)) is false
autoimplement.d(14):        instantiated from here: AutoImplement!(A, tpl, isAbstractFunction)
@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2019-03-05T06:00:37Z

@thaven updated dlang/phobos pull request #6876 "Also expose 'parent' when it's abstract" mentioning this issue:

- Temporarily comment out overload in test to work around Issue 19715

https://github.com/dlang/phobos/pull/6876

@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2022-01-18T03:54:11Z

dlang/phobos pull request #6876 "Also expose 'parent' when it's abstract" was merged into master:

- 47291bb0e6f3169737139a92b33887c7e588dd8f by thaven:
  Temporarily comment out overload in test to work around Issue 19715

https://github.com/dlang/phobos/pull/6876

@thewilsonator thewilsonator removed P3 Arch:x86 Issues specific to x86 labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants