From 19e687ff03263ea27c91a99db4f1b7a9b4c9006a Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 20 Jul 2017 05:48:26 +0000 Subject: [PATCH] parse.y: empty hash in defined * parse.y (command): NODE_ARRAY with NULL is invalid. traversal in defined_expr0 is simplified than iseq_compile_each0. [ruby-core:82113] [Bug #13756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 2 +- test/ruby/test_syntax.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/parse.y b/parse.y index 3a58d2ee90..58cec8961d 100644 --- a/parse.y +++ b/parse.y @@ -2293,7 +2293,7 @@ call_args : command | assocs opt_block_arg { /*%%%*/ - $$ = NEW_LIST($1 ? new_hash($1) : 0); + $$ = $1 ? NEW_LIST(new_hash($1)) : 0; $$ = arg_blk_pass($$, $2); /*% $$ = arg_add_assocs(arg_new(), $1); diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 5f0a236619..bd93285ac4 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -169,10 +169,16 @@ class TestSyntax < Test::Unit::TestCase end def test_keyword_empty_splat - assert_separately([], <<-'end;') + assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}") + begin; bug10719 = '[ruby-core:67446] [Bug #10719]' assert_valid_syntax("foo(a: 1, **{})", bug10719) end; + assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}") + begin; + bug13756 = '[ruby-core:82113] [Bug #13756]' + assert_valid_syntax("defined? foo(**{})", bug13756) + end; end def test_keyword_self_reference