diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | class.c | 2 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 15 |
3 files changed, 22 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Sat Jun 4 11:30:57 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * class.c (check_mix_method_i, do_mix_method_i): not mix methods + renamed as nil. + Sat Jun 4 04:04:41 2011 NARUSE, Yui <naruse@ruby-lang.org> * test/rubygems/test_gem_commands_which_command.rb: @@ -745,6 +745,7 @@ check_mix_method_i(st_data_t key, st_data_t value, st_data_t arg) st_data_t alias; if (aliasing && st_lookup(aliasing, ID2SYM(id), &alias)) { + if (NIL_P(alias)) return ST_CONTINUE; id = rb_to_id(alias); } if (st_lookup(argp->mtbl, id, NULL)) { @@ -763,6 +764,7 @@ do_mix_method_i(st_data_t key, st_data_t value, st_data_t arg) st_data_t old, alias; if (aliasing && st_lookup(aliasing, ID2SYM(id), &alias)) { + if (NIL_P(alias)) return ST_CONTINUE; id = rb_to_id(alias); } if (st_lookup(argp->mtbl, id, &old)) { diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index ec29530f8e..72dc34ee0c 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1096,5 +1096,20 @@ class TestModule < Test::Unit::TestCase mix japanese, :address => :jp_address, :address= => :jp_address= } } + + japanese_american = Class.new + assert_nothing_raised(ArgumentError) { + japanese_american.class_eval { + mix japanese, :address => nil, :address= => nil + } + } + assert_raise(NoMethodError) { + japanese_american.new.address + } + assert_nothing_raised(ArgumentError) { + japanese_american.class_eval { + mix american + } + } end end |