Project

General

Profile

Backport #8367 » super-gone.rb

indirect (André Arko), 05/04/2013 10:20 AM

 
1
#!/usr/bin/env ruby
2

    
3
# This is a reproduction case for a bug that appeared in 2.0.0-p0, but is still present in trunk.
4
# In the bug, super should be defined inside a block passed to a method defined in a module that
5
# is extended to the object the method is called on, but it is not defined.
6

    
7
class C
8
  def x; end
9
end
10

    
11
module M
12
  def b; yield; end
13

    
14
  def x
15
    b do
16
      # On 1.9.3, this is "super", but on 2.0.0 it is nil
17
      p defined?(super)
18
    end
19
  end
20
end
21

    
22
c = C.new
23
c.extend M
24
c.x