diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-30 18:45:28 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-30 18:45:28 +0000 |
commit | f1d4e8b3b3be402621b043e858a8da5fc8797662 (patch) | |
tree | 114f7a8ecc4e280070eb50b6e477fdb76e28eda5 /test | |
parent | 255c16b5989f218208a1d595e6a84f61a1e23204 (diff) | |
download | ruby-f1d4e8b3b3be402621b043e858a8da5fc8797662.tar.gz |
* method.h: add VM_METHOD_TYPE_ALIAS rb_method_definition_t::type
to fix [Bug #11173].
Now, inter class/method alias creates new method entry
VM_METHOD_TYPE_ALIAS, which has an original method entry.
* vm_insnhelper.c (find_defiend_class_by_owner): added.
Search corresponding defined_class from owner class/module.
* vm_method.c (rb_method_entry_get_without_cache): return me->klass
directly for defined_class.
Now, no need to check me->klass any more.
* vm_method.c (method_entry_set0): separated from method_entry_set().
* vm_method.c (rb_alias): make method entry has VM_METHOD_TYPE_ALIAS.
* vm_method.c (release_method_definition): support VM_METHOD_TYPE_ALIAS.
* vm_method.c (rb_hash_method_definition): ditto.
* vm_method.c (rb_method_definition_eq): ditto.
* vm_method.c (release_method_definition): ditto.
* vm_insnhelper.c (vm_call_method): ditto.
* vm_insnhelper.c (vm_method_cfunc_entry): ditto.
* vm_eval.c (vm_call0_body): ditto.
* gc.c (mark_method_entry): ditto.
* proc.c (method_def_iseq): ditto.
* proc.c (method_cref): ditto.
* proc.c (rb_method_entry_min_max_arity): ditto.
* test/ruby/test_alias.rb: add tests.
* test/ruby/test_module.rb: fix a test to catch up current behavior.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_alias.rb | 9 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/test/ruby/test_alias.rb b/test/ruby/test_alias.rb index 8901fc243c..802c196355 100644 --- a/test/ruby/test_alias.rb +++ b/test/ruby/test_alias.rb @@ -193,4 +193,13 @@ class TestAlias < Test::Unit::TestCase assert_equal(o.to_s, o.orig_to_s, bug) end; end + + class C0; def foo; end; end + class C1 < C0; alias bar foo; end + + def test_alias_method_equation + obj = C1.new + assert_equal(obj.method(:bar), obj.method(:foo)) + assert_equal(obj.method(:foo), obj.method(:bar)) + end end diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 9c5ec6032a..8bfdf8db35 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -2042,7 +2042,7 @@ class TestModule < Test::Unit::TestCase A.prepend InspectIsShallow - expect = "#<Method: A(Object)#inspect(shallow_inspect)>" + expect = "#<Method: A(ShallowInspect)#inspect(shallow_inspect)>" assert_equal expect, A.new.method(:inspect).inspect, "#{bug_10282}" RUBY end |