fix issue 22584: upgrade foreach variable shadowing from deprecation to error#22677
fix issue 22584: upgrade foreach variable shadowing from deprecation to error#22677Utkal059 wants to merge 2 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @Utkal059! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
|
8e0e8c8 to
f1025e4
Compare
…to error Fix Bugzilla 22584
f1025e4 to
8f57389
Compare
thewilsonator
left a comment
There was a problem hiding this comment.
you will need to have a chanelog entry for this. cc @dkorpel should this be done at all or done via editions?
|
You linked to an unrelated bugzilla issue, I think you meant github issue #22584? EDIT: I think you can remove the -de switch from the REQUIRED_ARGS comment as well. |
|
I've fixed the trailing whitespace issue. |
Fixes Issue 22584
Hi, this is my first contribution to DMD.
While going through open issues I noticed that foreach variable
shadowing was still showing a deprecation warning even though
the deprecation period has already ended.
What I changed:
In expressionsem.d I changed the diagnostic from deprecation()
to error() for foreach variables that shadow outer scope symbols.
Why I made this change:
Since the deprecation period is over this should now be a hard
error. It also helps catch subtle bugs where a foreach variable
accidentally hides an outer variable without the programmer noticing.
Testing:
I confirmed that the correct error message appears when
shadowing occurs in a foreach loop.
Closes: https://issues.dlang.org/show_bug.cgi?id=22584