diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 4 | ||||
-rw-r--r-- | test/ruby/test_keyword.rb | 8 |
3 files changed, 17 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Mon Jan 7 15:42:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * parse.y (f_kwrest): allow bare kwrest_mark as valid syntax. its + semantics is still undefined. [Bug #7662] [ruby-core:51269] + Mon Jan 7 15:31:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> * parse.y (f_kwrest): reject duplicated kwrest argument name. @@ -4685,6 +4685,10 @@ f_kwrest : kwrest_mark tIDENTIFIER shadowing_lvar(get_id($2)); $$ = $2; } + | kwrest_mark + { + $$ = internal_id(); + } ; f_opt : tIDENTIFIER '=' arg_value diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 8fe69b44fb..3685024991 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -1,4 +1,5 @@ require 'test/unit' +require_relative 'envutil' class TestKeywordArguments < Test::Unit::TestCase def f1(str: "foo", num: 424242) @@ -266,4 +267,11 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal(expect, rest_keyrest(*expect), bug7665) assert_equal(expect, proc {|*args, **opt| next *args, opt}.call(*expect), bug7665) end + + def test_bare_kwrest + # valid syntax, but its semantics is undefined + assert_valid_syntax("def bug7662(**) end") + assert_valid_syntax("def bug7662(*, **) end") + assert_valid_syntax("def bug7662(a, **) end") + end end |