Bug 17791 – Add __traits(isDeprecated, ...)

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-08-28T21:29:15Z
Last change time
2021-01-03T22:57:12Z
Assigned to
No Owner
Creator
Jonathan M Davis

Comments

Comment #0 by issues.dlang — 2017-08-28T21:29:15Z
There is currently no way to test whether a particular symbol is deprecated. This isn't commonly needed, but it can matter when doing introspection on all of the symbols within a module or class and generating code based on the list of symbols, since skipping deprecated symbols in those cases would be required to avoid creating deprecation warnings, and if someone actually used -de, then the code could not compile because of the inadvertent use of deprecated symbols, and there would be no way to avoid using those deprecated symbols, since there's currently no way to introspect whether a symbol is deprecated or not. functionAttributes could be improved to include deprecated, but that would only cover functions, and just about any symbol can be deprecated, so I would suggest simply adding a new trait to do the test. e.g. __traits(isDeprecated, symbol).
Comment #1 by petar.p.kirov — 2017-08-29T09:19:14Z
Ditto for @future.
Comment #2 by github-bugzilla — 2017-10-05T16:12:07Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9e131398d7f8c7a296fecda942f77c336c7bd611 fix issue 17791 - add __traits(deprecated, symbol) https://github.com/dlang/dmd/commit/70d909eea541d528bb4835bef30db8a7d889ed1b Merge pull request #7178 from dunkyp/master fix issue 17791 - add __traits(deprecated, symbol)
Comment #3 by greensunny12 — 2017-10-05T18:09:33Z
Comment #4 by dlang-bot — 2021-01-03T22:57:12Z
dlang/dmd pull request #12093 "[dmd-cxx] Backport more recent traits to the C++ port" was merged into dmd-cxx: - 349f960f54688b70a38f3e40bd2df5b67f5dbafc by dunkyp: [dmd-cxx] fix issue 17791 - add __traits(deprecated, symbol) https://github.com/dlang/dmd/pull/12093