diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-16 19:43:02 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-16 19:43:02 +0000 |
commit | b118f5d82f9d23f388ff951dd0574bb18d7cf18a (patch) | |
tree | 308975e04093ef62e6ca644bd01eec44c47eb06a /test/ruby | |
parent | 53298a28cbb7304f2f33590b374b681e9ea5661c (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_3@54618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-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 70b3934d4f..9f3bd0dab3 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -360,6 +360,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 } |