Project

General

Profile

Backport #7983

Fixnumの演算子がprependでオーバーライドできない

Added by tera (yuki teraoka) over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
[ruby-dev:47124]

Description

=begin
Fixnumの演算子をprependを使ってオーバーライドしても、適用されない。

sendで実行した場合はprependしたmoduleのメソッドが実行される。

【再現手順】

module M
def /(other)
to_f / other
end
end

Fixnum.send(:prepend, M)

1 / 2 #=> 0
1.send(:/, 2) #=> 0.5
=end

Associated revisions

Revision f113ab55
Added by nobu (Nobuyoshi Nakada) over 6 years ago

class.c: check redefinition

  • class.c (rb_prepend_module): check redefinition of built-in opimized methods. [ruby-dev:47124] [Bug #7983]
  • vm.c (rb_vm_check_redefinition_by_prepend): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 39601
Added by nobu (Nobuyoshi Nakada) over 6 years ago

class.c: check redefinition

  • class.c (rb_prepend_module): check redefinition of built-in opimized methods. [ruby-dev:47124] [Bug #7983]
  • vm.c (rb_vm_check_redefinition_by_prepend): ditto.

Revision 39601
Added by nobu (Nobuyoshi Nakada) over 6 years ago

class.c: check redefinition

  • class.c (rb_prepend_module): check redefinition of built-in opimized methods. [ruby-dev:47124] [Bug #7983]
  • vm.c (rb_vm_check_redefinition_by_prepend): ditto.

Revision 39601
Added by nobu (Nobuyoshi Nakada) over 6 years ago

class.c: check redefinition

  • class.c (rb_prepend_module): check redefinition of built-in opimized methods. [ruby-dev:47124] [Bug #7983]
  • vm.c (rb_vm_check_redefinition_by_prepend): ditto.

Revision 39601
Added by nobu (Nobuyoshi Nakada) over 6 years ago

class.c: check redefinition

  • class.c (rb_prepend_module): check redefinition of built-in opimized methods. [ruby-dev:47124] [Bug #7983]
  • vm.c (rb_vm_check_redefinition_by_prepend): ditto.

Revision 39601
Added by nobu (Nobuyoshi Nakada) over 6 years ago

class.c: check redefinition

  • class.c (rb_prepend_module): check redefinition of built-in opimized methods. [ruby-dev:47124] [Bug #7983]
  • vm.c (rb_vm_check_redefinition_by_prepend): ditto.

Revision 39601
Added by nobu (Nobuyoshi Nakada) over 6 years ago

class.c: check redefinition

  • class.c (rb_prepend_module): check redefinition of built-in opimized methods. [ruby-dev:47124] [Bug #7983]
  • vm.c (rb_vm_check_redefinition_by_prepend): ditto.

Revision 6ab0f648
Added by nagachika (Tomoyuki Chikanaga) about 6 years ago

merge revision(s) 39601 and 39602(partially): [Backport #7983]

    * class.c (rb_prepend_module): check redefinition of built-in optimized
      methods.  [ruby-dev:47124] [Bug #7983]

    * vm.c (rb_vm_check_redefinition_by_prepend): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 39912
Added by nagachika (Tomoyuki Chikanaga) about 6 years ago

merge revision(s) 39601 and 39602(partially): [Backport #7983]

* class.c (rb_prepend_module): check redefinition of built-in optimized
  methods.  [ruby-dev:47124] [Bug #7983]

* vm.c (rb_vm_check_redefinition_by_prepend): ditto.

History

#1

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39601.
yuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


class.c: check redefinition

  • class.c (rb_prepend_module): check redefinition of built-in opimized methods. [ruby-dev:47124] [Bug #7983]
  • vm.c (rb_vm_check_redefinition_by_prepend): ditto.
#2

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby trunk to Backport200
  • Status changed from Closed to Assigned
  • Assignee set to nagachika (Tomoyuki Chikanaga)
#3

Updated by nagachika (Tomoyuki Chikanaga) about 6 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r39912.
yuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39601 and 39602(partially): [Backport #7983]

* class.c (rb_prepend_module): check redefinition of built-in optimized
  methods.  [ruby-dev:47124] [Bug #7983]

* vm.c (rb_vm_check_redefinition_by_prepend): ditto.

Also available in: Atom PDF