Skip to content

Commit

Permalink
Merge pull request #3467 from jstuder-gh/named_param_lta_error_msg
Browse files Browse the repository at this point in the history
Change err msg for pos after named in signature
  • Loading branch information
jnthn committed Feb 11, 2020
2 parents cdc907b + 8dcf1a8 commit ab9c1ff
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Perl6/Grammar.nqp
Expand Up @@ -2695,7 +2695,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
# enforce zone constraints
{
my $kind :=
$<named_param> ?? '*' !!
$<named_param> ?? 'n' !!
$<quant> eq '?' || $<default_value> ?? '?' !!
$<quant> eq '!' ?? '!' !!
$<quant> ne '' && $<quant> ne '\\' ?? '*' !!
Expand All @@ -2708,6 +2708,9 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
elsif $*zone eq 'var' {
$/.typed_panic('X::Parameter::WrongOrder', misplaced => 'required', after => 'variadic', parameter => $name);
}
elsif $*zone eq 'named' {
$/.typed_panic('X::Parameter::WrongOrder', misplaced => 'required', after => 'named', parameter => $name);
}
}
elsif $kind eq '?' {
if $*zone eq 'posreq' {
Expand All @@ -2716,10 +2719,16 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
elsif $*zone eq 'var' {
$/.typed_panic('X::Parameter::WrongOrder', misplaced => 'optional positional', after => 'variadic', parameter => $name);
}
elsif $*zone eq 'named' {
$/.typed_panic('X::Parameter::WrongOrder', misplaced => 'optional positional', after => 'named', parameter => $name);
}
}
elsif $kind eq '*' {
$*zone := 'var';
}
elsif $kind eq 'n' {
$*zone := 'named';
}
%*PARAM_INFO<is_multi_invocant> := $*multi_invocant;
%*PARAM_INFO<node> := $/;
Expand Down

0 comments on commit ab9c1ff

Please sign in to comment.