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
Issue 18314 - std.traits.getSymbolsByUDA only considers the first sym… #6085
Conversation
Thanks for your pull request, @Biotronic! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla references
|
9173971
to
e1486c8
Compare
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.
Good job 👍
I especially like the bit that it's now without mixins
:)
std/traits.d
Outdated
@@ -7856,6 +7833,49 @@ template getSymbolsByUDA(alias symbol, alias attribute) | |||
alias getSymbolsByUDA = membersWithUDA; | |||
} | |||
|
|||
template getSymbolsByUDAImpl(alias symbol, alias attribute, names...) |
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.
private
?
(The Jenkins + CircleCI failures are unrelated) |
e1486c8
to
53346a1
Compare
The thing I dislike about my implementation is |
Thanks for the PR @Biotronic. I was planning on fixing it myself, but you were way too fast 😄 (I reported it like 24 hours ago) |
std/traits.d
Outdated
void foo(int a); | ||
} | ||
|
||
assert(getSymbolsByUDA!(A, lal).length == 2); |
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.
static assert(...
twice.
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.
Right. This should be done at CT.
std/traits.d
Outdated
|
||
struct A | ||
{ | ||
@lal |
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.
insert this declaration first
@lal
void foo()(string){}
update the assertions accordingly, and have fun.
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.
For the sake of style, could we use @Attr1
and @Attr2
instead of @lol
and @lal
? I know I originally used those in my issue report, but it definitely was not my intention that such funny names ended up in the source code.
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 bug has already been filed in BugZilla. Looks to be by you:
https://issues.dlang.org/show_bug.cgi?id=16206
It's not the mandate of this PR to fix bugs in DMD. That said, mentioning the bug in the test is probably a good idea.
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.
Indeed. I planned to put the link to the issue after a possible "wtf" reaction from your part. But things didn't happen as expected.
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.
WTF?!
Here. Feeling better now?
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 originally used those in my issue report, but it definitely was not my intention that such funny names ended up in the source code.
If you already come with the style, it should be attr1
and attr2
- https://dlang.org/dstyle.html#naming_udas
But meh, I don't have a preference between these two. It's quite typical for contributors to put the code from the issue 1:1 into Phobos. Also it doesn't end up in the user documentation.
And if you disagree, this can always be improved. It shouldn't block this PR.
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.
Indeed. I planned to put the link to the issue after a possible "wtf" reaction from your part. But things didn't happen as expected.
Please refrain from wasting valuable time of other contributors in the future.
A simple comment:
I just bumped into a similar issue. See XYZ
would have saved all parties time...
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.
Sure, but we'd have less fun that way.
…bol of an overload set
53346a1
to
20c3e7f
Compare
And apparently I broke the auto-merge when I addressed the stuff that was mentioned above. |
…bol of an overload set
This change expands overload sets such that each overload is considered separately.