mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
* method.h: introduce rb_method_definition_t::complemented_count.
* vm_method.c (method_definition_addref_complement): introduced. def->alias_count is used to decide warn or do not warn at method redefinition. Complented methods should not prevent redefiniton warnings. * vm_method.c (rb_method_definition_release): release def iff alias_count == 0 && complemented_count == 0. * test/ruby/test_module.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ec217619b6
commit
fa4e516db9
4 changed files with 58 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue