-
Notifications
You must be signed in to change notification settings - Fork 19
Fix deprecation warning: UDA extraction for overload sets #93
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,7 +116,22 @@ template getUDAs(alias symbol, alias attribute) | |
| static if (AliasSeq!symbol.length != 1) | ||
| alias getUDAs = AliasSeq!(); | ||
| else | ||
| static if (__traits(compiles, __traits(getAttributes, symbol))) | ||
| static if (__traits(compiles, __traits(getOverloads, symbol))) | ||
| { | ||
| alias overloads = __traits(getOverloads, symbol); | ||
| static if (overloads.length > 0) | ||
| { | ||
| alias getUDAsImpl(alias overload) = Filter!(isDesiredUDA!attribute, __traits(getAttributes, overload)); | ||
| alias getUDAs = AliasSeq!(staticMap!(getUDAsImpl, overloads)); | ||
| } | ||
| else static if (__traits(compiles, __traits(getAttributes, symbol))) | ||
| { | ||
| alias getUDAs = Filter!(isDesiredUDA!attribute, __traits(getAttributes, symbol)); | ||
| } | ||
| else | ||
| alias getUDAs = AliasSeq!(); | ||
| } | ||
|
Comment on lines
+119
to
+133
|
||
| else static if (__traits(compiles, __traits(getAttributes, symbol))) | ||
| alias getUDAs = Filter!(isDesiredUDA!attribute, __traits(getAttributes, symbol)); | ||
| else | ||
| alias getUDAs = AliasSeq!(); | ||
|
|
@@ -243,8 +258,23 @@ private template isFunction(T, string member) | |
|
|
||
| private template autoGetUDAs(alias symbol) | ||
| { | ||
| import std.meta : AliasSeq; | ||
| static if (__traits(compiles, __traits(getAttributes, symbol))) | ||
| import std.meta : AliasSeq, staticMap; | ||
| static if (__traits(compiles, __traits(getOverloads, symbol))) | ||
| { | ||
| alias overloads = __traits(getOverloads, symbol); | ||
| static if (overloads.length > 0) | ||
| { | ||
| alias autoGetUDAsImpl(alias overload) = __traits(getAttributes, overload); | ||
| alias autoGetUDAs = AliasSeq!(staticMap!(autoGetUDAsImpl, overloads)); | ||
| } | ||
| else static if (__traits(compiles, __traits(getAttributes, symbol))) | ||
| { | ||
| alias autoGetUDAs = __traits(getAttributes, symbol); | ||
| } | ||
| else | ||
| alias autoGetUDAs = AliasSeq!(); | ||
| } | ||
| else static if (__traits(compiles, __traits(getAttributes, symbol))) | ||
| alias autoGetUDAs = __traits(getAttributes, symbol); | ||
| else | ||
| alias autoGetUDAs = AliasSeq!(); | ||
|
|
||
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.
New behavior for overload sets is introduced here, but the file’s unittests don’t cover overloaded symbols (multiple overloads with/without the target UDA). Adding a dedicated unittest for an overloaded function name would help prevent regressions and confirm the intended aggregation semantics across overloads.