Project

General

Profile

Actions

Bug #11636

closed

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

Added by shugo (Shugo Maeda) about 9 years ago. Updated almost 5 years ago.

Status:
Closed
Target version:
-
[ruby-core:71274]

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).


Files

instance_eval-module-super-11636.patch (4.93 KB) instance_eval-module-super-11636.patch jeremyevans0 (Jeremy Evans), 08/21/2019 09:12 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #2402: super in instance_evalClosedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0