Project

General

Profile

Actions

Bug #11635

closed

super in instance_eval in a method defined in a module is invoked with a wrong receiver

Added by shugo (Shugo Maeda) over 8 years ago. Updated over 8 years ago.

Status:
Rejected
Target version:
-
[ruby-dev:49317]

Description

super in instance_eval in a method defined in a module is invoked with a wrong receiver:

class Foo
  def initialize
    @foo = :foo
  end
 
  def foo
    p [self, @foo]
  end
end
 
module M
  def foo
    x = Object.new
    x.instance_eval do
      super
    end
  end
end
 
class Bar < Foo
  include M
end
 
Bar.new.foo

The output should be [#<Foo:...>, :foo] or an exception.
Matz prefer the former (https://twitter.com/yukihiro_matz/status/659913844861464576).

Updated by shugo (Shugo Maeda) over 8 years ago

  • Status changed from Assigned to Rejected
Actions

Also available in: Atom PDF

Like0
Like0