[perl #132337] [BUG] Code block inside `andthen`/`orelse` doesn't close over lexical variables correctly

[email protected] ("Zoffix Znet via RT")
Newsgroups perl.perl6.compiler
Message-ID <[email protected]>
On Sat, 21 Oct 2017 06:23:40 -0700, [email protected] wrote:
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.