ruby-changes:41413
From: nobu <ko1@a...>
Date: Sat, 9 Jan 2016 18:26:05 +0900 (JST)
Subject: [ruby-changes:41413] nobu:r53485 (trunk): symbol.h: unexpected safe call
nobu 2016-01-09 18:26:23 +0900 (Sat, 09 Jan 2016) New Revision: 53485 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53485 Log: symbol.h: unexpected safe call * symbol.h (is_attrset_id): ASET is an attrset ID. fix unexpected safe call instead of an ordinary ASET. Modified files: trunk/ChangeLog trunk/symbol.h trunk/test/ruby/test_call.rb Index: test/ruby/test_call.rb =================================================================== --- test/ruby/test_call.rb (revision 53484) +++ test/ruby/test_call.rb (revision 53485) @@ -83,4 +83,11 @@ class TestCall < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_call.rb#L83 def test_safe_call_block_call_command assert_nil(("a".sub! "b" do end&.foo 1 do end)) end + + def test_invalid_safe_call + h = nil + assert_raise(NoMethodError) { + h[:foo] = nil + } + end end Index: symbol.h =================================================================== --- symbol.h (revision 53484) +++ symbol.h (revision 53485) @@ -36,7 +36,7 @@ struct RSymbol { https://github.com/ruby/ruby/blob/trunk/symbol.h#L36 #define is_local_id(id) (id_type(id)==ID_LOCAL) #define is_global_id(id) (id_type(id)==ID_GLOBAL) #define is_instance_id(id) (id_type(id)==ID_INSTANCE) -#define is_attrset_id(id) (id_type(id)==ID_ATTRSET) +#define is_attrset_id(id) ((id)==idASET||id_type(id)==ID_ATTRSET) #define is_const_id(id) (id_type(id)==ID_CONST) #define is_class_id(id) (id_type(id)==ID_CLASS) #define is_junk_id(id) (id_type(id)==ID_JUNK) Index: ChangeLog =================================================================== --- ChangeLog (revision 53484) +++ ChangeLog (revision 53485) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Jan 9 18:25:57 2016 Nobuyoshi Nakada <nobu@r...> + + * symbol.h (is_attrset_id): ASET is an attrset ID. fix + unexpected safe call instead of an ordinary ASET. + Sat Jan 9 10:44:33 2016 Nobuyoshi Nakada <nobu@r...> * configure.in, win32/setup.mak: extract RUBY_PROGRAM_VERSION from -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/