Project

General

Profile

Bug #730 » bug19.rb

Earlier test cases - sander (Sander Land), 11/09/2008 06:22 AM

 
def wrap(m)
Module.new{
include m
def foo
super * 3
end
}
end

module A
def foo
"Hello!"
end
end

# stack level too deep (SystemStackError) in 1.9
$mod = [A,A]
$mod.map{|mod| wrap(mod) }.each{|m|
p Class.new{ include m }.new.foo
}
# NO error in 1.9 when removing the map
$mod.each{|mod|
m = wrap(mod)
p Class.new{ include m }.new.foo
}

# Also an error on 'manual map'
$mod = [wrap(A),wrap(A)]
$mod.each{|m|
p Class.new{ include m }.new.foo
}

# But no error on mapping single-element arrays
$mod = [A]
$mod.map{|mod| wrap(mod) }.each{|m|
p Class.new{ include m }.new.foo
}


(1-1/2)