Skip to content

Commit

Permalink
Fix crash on redeclaration check of non-sub &foo var
Browse files Browse the repository at this point in the history
The redeclaration check assumes the previous thing is a Routine
and crashes when it tries to reach for $!yada that isn't present
in my &foo; Callable.

Fix by checking the symbol is a Routine before trying to check
whether it's a yada.

Bug find: https://irclog.perlgeek.de/perl6/2017-02-13#i_14093827
  • Loading branch information
zoffixznet committed Feb 14, 2017
1 parent aac9efc commit b51a550
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Perl6/Actions.nqp
Expand Up @@ -3537,7 +3537,9 @@ class Perl6::Actions is HLL::Actions does STDActions {
# Always install in lexpad unless predeclared.
my $predeclared := $outer.symbol($name);
if $predeclared {
unless nqp::getattr_i($predeclared<value>, $*W.find_symbol(['Routine'], :setting-only), '$!yada') {
my $Routine := $*W.find_symbol(['Routine'], :setting-only);
unless nqp::istype( $predeclared<value>, $Routine)
&& nqp::getattr_i($predeclared<value>, $Routine, '$!yada') {
$*W.throw($/, ['X', 'Redeclaration'],
symbol => ~$<deflongname>.ast,
what => 'routine',
Expand Down

0 comments on commit b51a550

Please sign in to comment.