-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Fix Issue 23241 - Consider types with no symbol (e.g. int) to have no… #14298
Conversation
|
Thanks for your pull request, @maxhaton! Bugzilla references
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a blocker, should it target stable?
|
I think the trait should accept anything semantically correct and just return an empty tuple if no uda is available, static if (__traits(compiles, __traits(getAttributes, arg)))
alias udas = __traits(getAttributes, arg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch seems to address a symptom of a larger issue: eager substitution of alias. For example, this patch ignores the UDA for:
@("hi2") alias MyEnum = int;Maybe semanticTiargs can be modified as to not substitute the alias in this situation. However, this may be complicated since you may have an alias to a symbol that also has an UDA. I think that getAttributes should only get the UDA of the alias, not for the aliased symbol.
That's a much bigger change of behaviour that would probably break quite a lot of code if done wrong |
@RazvanN7 I have fixed the code. Please remove your requested changes as it has nothing to do with this PR and constitutes a large change in behaviour which would have to be decided somewhere else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I offer a suggestion, and still it's spelled wrong.
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
|
Well, I am not convinced that this is the right fix. It seems to me that this PR is like giving painkillers to a cancer patient. Sure, it makes it better, but it's not actually addressing the real issue. However, I don't want to block this if others agree that it should get in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good me. Even if the right thing to do is not resolve aliases too early, this change is still a step in the right direction as __traits(getAttributes, int) should return an empty value sequence, instead of failing to compile (expressed differently: all types should be symbols, including built-in ones).
… attributes
not completely convinced about this