Skip Menu |
Report information
Id: 132337
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: smls75 [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] Code block inside `andthen`/`orelse` doesn't close over lexical variables correctly
From: Sam S <smls75 [...] gmail.com>
Date: Sat, 21 Oct 2017 15:23:27 +0200
To: Rakudo Bugtracker <rakudobug [...] perl.org>
Download (untitled) / with headers
text/plain 378b
Golfed example: sub foo ($str) { { say $str }() orelse Nil } foo "aa"; # aa foo "bb"; # aa The second call should print "bb", not "aa". Replacing the `say` with `return`, throws "Attempt to return outside of any Routine" on the second call (but not the first), indicating that something is going wrong with cloning the interpolated closure.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 638b
On Sat, 21 Oct 2017 06:23:40 -0700, smls75@gmail.com wrote: Show quoted text
> Golfed example: > > sub foo ($str) { > { say $str }() orelse Nil > } > > foo "aa"; # aa > foo "bb"; # aa > > The second call should print "bb", not "aa". > > Replacing the `say` with `return`, throws "Attempt to return outside of > any Routine" on the second call (but not the first), indicating that > something is going wrong with cloning the interpolated closure.
Thank you for the report. This is now fixed. Fix: https://github.com/rakudo/rakudo/commit/1ee89b54074e80c Test: https://github.com/perl6/roast/commit/2f2998733a2d8132c


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org