summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--class.c2
-rw-r--r--test/ruby/test_module.rb15
3 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 55f97bbc87..e251b2d543 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
diff --git a/class.c b/class.c
index 2a2b3ef131..e7c42daad7 100644
--- a/class.c
+++ b/class.c
@@ -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