aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_syntax.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-15 06:44:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-15 06:44:36 +0000
commitab3a3948b0f94a616461b0da9bc6769e13673e23 (patch)
treea9a4e5c2aed30ceb6b9ba75dfe0980f5a6e2c69b /test/ruby/test_syntax.rb
parent2e0ebf4e080331773fcd1c5f2f37cdce74569e99 (diff)
downloadruby-ab3a3948b0f94a616461b0da9bc6769e13673e23.tar.gz
parse.y: kwarg to method with same name variable
* 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/trunk@53835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r--test/ruby/test_syntax.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 97a1e5b63d..11b3f27582 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 }