From ae07b66aaa092c59ac9d544c9b582712290dc357 Mon Sep 17 00:00:00 2001 From: Seiei Miyagi Date: Tue, 23 Apr 2019 00:01:17 +0900 Subject: [PATCH] Fix internal error of `->x:@2{}` [Fix GH-2139] [Bug #15783] --- parse.y | 1 + test/ruby/test_syntax.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/parse.y b/parse.y index 450f1c0ef0..a97c01d69a 100644 --- a/parse.y +++ b/parse.y @@ -4799,6 +4799,7 @@ f_label : tLABEL ID id = get_id($1); arg_var(p, formal_argument(p, id)); p->cur_arg = id; + p->max_numparam = -1; $$ = $1; } ; diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 6e397a9c00..488962b003 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1301,6 +1301,7 @@ eom assert_syntax_error('->(){@1}', /ordinary parameter is defined/) assert_syntax_error('->(x){@1}', /ordinary parameter is defined/) assert_syntax_error('->x{@1}', /ordinary parameter is defined/) + assert_syntax_error('->x:@2{}', /ordinary parameter is defined/) assert_syntax_error('proc {@1 = nil}', /Can't assign to numbered parameter @1/) assert_syntax_error('proc {@01}', /leading zero/) assert_syntax_error('proc {@1_}', /unexpected/)