-
-
Notifications
You must be signed in to change notification settings - Fork 606
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 16495 - __traits(fullyQualifedName) instead of std.traits.f… #14711
Conversation
Thanks for your pull request, @WalterBright! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#14711" |
6fc9dc5
to
050bb13
Compare
Will add more tests later. |
050bb13
to
c06bb8b
Compare
I'm in favor of this change. I would like to point out there's also another problematic trait that is way simpler to implement in the compiler and increase a lot compile-times. |
@lmjf00 Please file enhancement requests in bugzilla. |
@WalterBright any progres on this? |
c06bb8b
to
10eadbf
Compare
I added the tests from std.traits. But the results aren't identical, as there are multiple ways to print the same fully qualified name. |
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.
Also, please replaces the pragma(msg)s with static asserts in test16495.d
.
|
||
Scope* sc2 = sc.push(); | ||
sc2.flags = sc.flags | SCOPE.noaccesscheck | SCOPE.ignoresymbolvisibility; | ||
bool ok = TemplateInstance.semanticTiargs(e.loc, sc2, e.args, 1); |
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 line is redundant. `TemplateInstance.semanticTiargs is already called at the beginning of this function.
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.
It's not quite the same. The sc2.flags
are changed.
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.
Yes, but since semantic has already been performed all of the expressions have their type set and when they hit the expression semantic visit methods (which typically start with if (exp.type) return
) no analysis is done. So, I suspect that this code only adds a couple of function calls that simply return.
Could we start deprecating |
10eadbf
to
131569f
Compare
Better to just re-implement it as a shell calling |
5dadfd6
to
2465dca
Compare
…ullyQualifiedName
2465dca
to
4dc346f
Compare
Documentation: dlang/dlang.org#3495 |
As I've said many many times, any code that calls this is questionable. There's no real benefit to improving a function that should never actually be used. I'm not against it per se, but.... if people think they need this, they're almost certainly wrong. |
@WalterBright Just add a small changelog entry so that users of the next release can find out about this feature and we are good to go. Thanks! |
There's still test coverage missing for failure cases |
Why are we adding more useless cruft to the language when there clear cases of harm done by it that is avoided by easy to use alternative techniques? |
Those are kinda hard to figure out how to trigger. |
…ullyQualifiedName
As the bug report suggests, this is better done in the compiler than with complex metaprogramming which is a bit of a speed problem. The library template also duplicates code which must be in the compiler anyway, why do it twice.