On Sat, 11 Feb 2017 03:29:18 -0800, moritz wrote:
> sub f($x) {
>       sub {
>               if True {
>                       say &?ROUTINE.name
>               }
>       }
> }.(42)()
> 
> This prints f on Rakudo 2017.01-170-gc0a907f built on MoarVM version
> 2017.01-31-g20dfa6b
> 
> &?ROUTINE should refer to the inner, anonymous subroutine here, not to
> &f. The same bug happens if the inner subroutine is named, but not if
> the "if"-block is absent.
> 
> 

Seems an optimizer bug. Goes away if you switch it off:

$ perl6 --optimize=3   -e 'sub f($x) { sub y { if True { say &?ROUTINE.name } } 
}.(42)()'
f
$ perl6 --optimize=off -e 'sub f($x) { sub y { if True { say &?ROUTINE.name } } 
}.(42)()'
y

Reply via email to