Skip to content

Commit

Permalink
Improve wrong arity error for anonymous subs
Browse files Browse the repository at this point in the history
If the routine doesn't have a name, use '<anon>' instead.
  • Loading branch information
MasterDuke17 committed Oct 15, 2017
1 parent 1706194 commit 084078e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Perl6/Metamodel/BOOTSTRAP.nqp
Expand Up @@ -166,6 +166,7 @@ my class Binder {
}
my str $s := $arity == 1 ?? "" !! "s";
my str $routine := nqp::getcodeobj(nqp::ctxcode($lexpad)).name;
$routine := '<anon>' unless $routine;

if $arity == $count {
return "$error_prefix positionals passed to '$routine'; expected $arity argument$s but got $num_pos_args";
Expand Down

0 comments on commit 084078e

Please sign in to comment.