diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-10 13:50:13 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-10 14:07:45 +0900 |
commit | c2065c64cb198d5b53a5ecdf9638d064f6fec2e2 (patch) | |
tree | 5fd8275eda79aeefc86fdec083bb8ac1e5d5ed8c /test/ruby | |
parent | a23b639050792c74cbf585aff6742c6ee3931f5f (diff) | |
download | ruby-c2065c64cb198d5b53a5ecdf9638d064f6fec2e2.tar.gz |
Fixed numbered parameter check
* parse.y (struct local_vars): moved numbered parameter NODEs for
nesting check to separate per local variable scopes, as numbered
parameters should belong to local variable scopes. [Bug #16248]
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_syntax.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 80bff868f6..48610da46d 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1465,6 +1465,10 @@ eom assert_syntax_error('-> {-> {_1}; _2}', /numbered parameter is already used/) assert_warn(/`_1' is used as numbered parameter/) {eval('proc {_1 = nil}')} assert_warn(/`_2' is used as numbered parameter/) {eval('_2=1')} + ['class C', 'class << C', 'module M', 'def m', 'def o.m'].each do |c| + assert_valid_syntax("->{#{c};->{_1};end;_1}\n") + assert_valid_syntax("->{_1;#{c};->{_1};end}\n") + end end def test_value_expr_in_condition |