develooper Front page | perl.perl5.porters | Postings from June 2016

[perl #127333] until( assignment ) doesn't warn when while(assignment ) does

Thread Previous
Dan Collins via RT
June 7, 2016 01:17
[perl #127333] until( assignment ) doesn't warn when while(assignment ) does
Message ID:
On Wed Jan 20 17:14:21 2016, tonyc wrote:
> This is similar to #127122, but doesn't have quite as simple a fix.

You're right.

I started by looking at what you did for #127122, but the "hack" of treating an unless as an if won't work here. Ultimately, I added a few lines of code to op.c to accept this special case - the condition which currently generates the warning, but with an OP_NOT around it.

I also added a test for this bug to t/lib/warnings/op, as well as a test for the related while(assignment) case, which didn't have a test. The tests reduce to while(0) and until(1) so as to not hang the entire test suite. All tests pass for me.

Patch attached, hopefully formatted correctly.

via perlbug:  queue: perl5 status: new

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About