Bug #11836
closed
Optimized methods cannot be overridden after Module#prepend
Added by shugo (Shugo Maeda) almost 9 years ago.
Updated almost 9 years ago.
Description
It seems that optimized methods cannot overridden after Module#prepend
.
module M
def /(other)
quo(other)
end
end
class Fixnum
prepend M
end
module M
def %(other)
0
end
def foo
puts "m#foo"
end
end
p 1 / 2 #=> (1/2) overridden
p 1 % 2 #=> 1 not overridden
1.foo #=> m#foo overridden
Is there any good way to disable optimization in this case?
- Status changed from Open to Closed
Applied in changeset r53179.
- vm_method.c (rb_method_entry_make, check_override_opt_method):
should check whether a newly created method override a optimize
method in case the method is defined in a prepended module of a
built-in class.
[ruby-core:72226] [Bug #11836]
- Subject changed from Optimized methods cannot overridden after Module#prepend to Optimized methods cannot be overridden after Module#prepend
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED
Also available in: Atom
PDF
Like0
Like0Like0