ActionsLike0
Bug #2402
closedsuper in instance_eval
Description
instance_eval
のブロック内でsuper
を呼ぶと、instance_eval
で変更された
self
に対してsuper
の呼び出しを行ってしまうようです。
defiant:build$ cat t.rb
class Foo
def foo
p self
end
end
class Bar < Foo
def foo
x = Object.new
x.instance_eval do
super
end
end
end
Bar.new.foo
defiant:build$ ./ruby-trunk.1124 -v t.rb
ruby 1.9.2dev (2009-11-24 trunk 25909) [i686-linux]
#<Object:0x8590f6c>
Foo#foo
が呼ばれるのにself
がObject
という、ちょっとおかしなことになっています。
ちょっと自信がありませんが、一応パッチを添付します。
Files
Updated by ujihisa (Tatsuhiro Ujihisa) over 15 years ago
- Status changed from Open to Assigned
- Assignee set to matz (Yukihiro Matsumoto)
Updated by mame (Yusuke Endoh) almost 15 years ago
- Assignee changed from matz (Yukihiro Matsumoto) to ko1 (Koichi Sasada)
Updated by nahi (Hiroshi Nakamura) almost 14 years ago
- Target version changed from 2.0.0 to 1.9.3
Updated by ko1 (Koichi Sasada) over 13 years ago
- Target version changed from 1.9.3 to 2.0.0
Updated by shugo (Shugo Maeda) over 12 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
Updated by shugo (Shugo Maeda) over 12 years ago
- Status changed from Closed to Open
Updated by ko1 (Koichi Sasada) over 12 years ago
- Priority changed from Normal to 5
Updated by shugo (Shugo Maeda) over 12 years ago
- Assignee changed from ko1 (Koichi Sasada) to matz (Yukihiro Matsumoto)
Updated by shugo (Shugo Maeda) over 9 years ago
- Related to Bug #11636: super in instance_eval in a method defined in a module is invoked with a wrong receiver added
ActionsLike0