Project

General

Profile

Actions

Bug #7643

closed

call to super in define_method in refine results in stack level too deep

Added by beatrichartz (Beat Richartz) almost 12 years ago. Updated almost 12 years ago.

Status:
Rejected
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-12-01 trunk 38126) [x86_64-darwin12.2.1]
Backport:
[ruby-core:51210]

Description

=begin
When (({define_method})) is used within the refine block argument, calls to super will result in a stack level too deep. Definitions with def can call super without problems.

module A
refine Fixnum do
%i(+ -).each do |m|
define_method m do |other|
super(other)
end
end

  def * other
    super(other)
  end
end

end

class B
using A

def working
  puts 'working'
  1 * 1
end

def error
  puts 'stack level too deep'
  1 + 1
end

end

puts B.new.working
puts B.new.error

=end


Files

bug.rb (359 Bytes) bug.rb beatrichartz (Beat Richartz), 01/01/2013 02:49 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0