Project

General

Profile

Actions

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.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:72226]

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?

Actions

Also available in: Atom PDF

Like0
Like0Like0