Bug 20033 – alias this does not support `deprecated` attribute
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-07-07T04:00:13Z
Last change time
2019-08-05T12:28:37Z
Keywords
pull
Assigned to
No Owner
Creator
Mathias LANG
Comments
Comment #0 by pro.mathias.lang — 2019-07-07T04:00:13Z
```
struct Test {
import std.typecons : Tuple;
alias KVT = Tuple!(string, "key", string, "value");
struct Range {
bool empty () { return false; }
KVT front() { return KVT.init; }
void popFront() {}
}
auto byKeyValue () { return Range.init; }
deprecated("This was a bad idea")
alias byKeyValue this;
}
void main ()
{
foreach (k, v; Test.init)
{
}
}
```
I expect `dmd -de test.d` to error out, but no message is triggered.
Comment #1 by dlang-bot — 2019-07-07T05:07:05Z
@Geod24 created vibe-d/vibe.d pull request #2334 "Collection of code cleanup" mentioning this issue:
- Do not use deprecated alias this in Vibe.d code
The `alias byKeyValue this` has been deprecated since v0.8.1 (released 2017-08-30).
However, thanks to issue 20033 the deprecation never triggered for user code.
This fixes Vibe.d code not to use the deprecated code.
However, removing the symbol is likely to break user code as the compiler does
not show any deprecation message at the moment.
https://github.com/vibe-d/vibe.d/pull/2334
Comment #2 by dlang-bot — 2019-07-07T05:07:05Z
@Geod24 created vibe-d/vibe.d pull request #2334 "Collection of code cleanup" mentioning this issue:
- Do not use deprecated alias this in Vibe.d code
The `alias byKeyValue this` has been deprecated since v0.8.1 (released 2017-08-30).
However, thanks to issue 20033 the deprecation never triggered for user code.
This fixes Vibe.d code not to use the deprecated code.
However, removing the symbol is likely to break user code as the compiler does
not show any deprecation message at the moment.
https://github.com/vibe-d/vibe.d/pull/2334
Comment #3 by pro.mathias.lang — 2019-07-08T05:11:26Z
Actually, after looking at the code, it simply does not support `deprecated`.
E.g. adding the following line to `main` does not trigger any deprecation:
```
auto i = Test.init.front();
```
Comment #4 by dlang-bot — 2019-07-10T17:05:11Z
vibe-d/vibe.d pull request #2334 "Collection of code cleanup" was merged into master:
- d909845cf5e4131671090bad5f53eacfdfc17978 by Geod24:
Do not use deprecated alias this in Vibe.d code
The `alias byKeyValue this` has been deprecated since v0.8.1 (released 2017-08-30).
However, thanks to issue 20033 the deprecation never triggered for user code.
This fixes Vibe.d code not to use the deprecated code.
However, removing the symbol is likely to break user code as the compiler does
not show any deprecation message at the moment.
https://github.com/vibe-d/vibe.d/pull/2334
Comment #5 by dlang-bot — 2019-08-03T07:32:49Z
@Geod24 created dlang/dmd pull request #10267 " Fix issue 20033 - Deprecation do not trigger on `alias this`" fixing this issue:
- Fix issue 20033 - Deprecation do not trigger on `alias this`
Before this change, `deprecated` on `alias this` was accepted by the parser
but silently ignored in semantic - as `Dsymbol` is never `deprecated`,
it is done through `Declaration` and derivatives
(`Dsymbol` does not have `storage_class`).
This fixes `alias this` to correctly trigger a deprecation message on usage.
https://github.com/dlang/dmd/pull/10267
Comment #6 by dlang-bot — 2019-08-05T12:28:37Z
dlang/dmd pull request #10267 " Fix issue 20033 - Deprecation do not trigger on `alias this`" was merged into master:
- c4f9506ab766bf4f3a747b45e7e646b64be96de6 by Geod24:
Fix issue 20033 - Deprecation do not trigger on `alias this`
Before this change, `deprecated` on `alias this` was accepted by the parser
but silently ignored in semantic - as `Dsymbol` is never `deprecated`,
it is done through `Declaration` and derivatives
(`Dsymbol` does not have `storage_class`).
This fixes `alias this` to correctly trigger a deprecation message on usage.
https://github.com/dlang/dmd/pull/10267