diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-18 08:15:51 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-18 08:15:51 +0000 |
commit | fc87e19f2d9cc0dbc252ef535eab5fb841c2f0b7 (patch) | |
tree | 659cc9ee4ffe825840cf55fb7db713e3fd48ca41 /test | |
parent | bf56a19d001b292787fbde7b18d7e76fbd21e42d (diff) | |
download | ruby-fc87e19f2d9cc0dbc252ef535eab5fb841c2f0b7.tar.gz |
* method.h: introduce the folliwing field and macros.
* rb_method_definition_t::complemented_count to count shared method
entries because of complemented method entries and separate from
alias_count.
Shared `def' only by complemented method entries should not prevent
method re-definition warning.
* METHOD_ENTRY_COMPLEMENTED(me) to represent complemented method entry.
* METHOD_ENTRY_COMPLEMENTED_SET(me) to check it as complemented me.
* vm_insnhelper.c (aliased_callable_method_entry): should also
check me->def->complemented_count.
* vm_method.c (method_definition_addref_complement): add to count
complemented method entries number.
* vm_method.c (rb_method_definition_release): release `def' iff
alias_count == 0 and complemented_count == 0.
* test/ruby/test_module.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_module.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index dbbeca850d..b86efd7005 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1280,6 +1280,20 @@ class TestModule < Test::Unit::TestCase undef foo end end + + stderr = EnvUtil.verbose_warning do + Module.new do + def foo; end + mod = self + c = Class.new do + include mod + end + c.new.foo + def foo; end + end + end + assert_match(/: warning: method redefined; discarding old foo/, stderr) + assert_match(/: warning: previous definition of foo/, stderr) end def test_protected_singleton_method |