diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-22 05:51:15 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-22 05:51:15 +0000 |
commit | 3df0e54b3b75e8e3625eae8ddb3934504153a9db (patch) | |
tree | ae533eef829846b89825d1cab0abad36bee17e0f /test | |
parent | 22a97cbf830ff18042a8b59df8eaa03ab29bbc30 (diff) |
merge revision(s) 53834,53835,53836: [Backport #12073]
parse.y: simplify local ID condition
* parse.y (tokenize_ident, parse_ident): ident in tokenize_ident()
can be a local id only when called from parse_ident(), but never
from parse_gvar() and parse_atmark().
* parse.y (parse_ident): allow keyword arguments just after a
method where the same name local variable is defined.
[ruby-core:73816] [Bug#12073]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_syntax.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 6fac862c32..6ddfefc40f 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -340,6 +340,13 @@ WARN assert_valid_syntax("{label: <<-DOC\n""DOC\n""}", bug11849) end + def test_cmdarg_kwarg_lvar_clashing_method + bug12073 = '[ruby-core:73816] [Bug#12073]' + a = 1 + assert_valid_syntax("a b: 1") + assert_valid_syntax("a = 1; a b: 1", bug12073) + end + def test_duplicated_arg assert_syntax_error("def foo(a, a) end", /duplicated argument name/) assert_nothing_raised { def foo(_, _) end } |