bug19.rb
| 1 |
def wrap(m) |
|---|---|
| 2 |
Module.new{
|
| 3 |
include m |
| 4 |
def foo |
| 5 |
super * 3 |
| 6 |
end
|
| 7 |
} |
| 8 |
end
|
| 9 |
|
| 10 |
module A |
| 11 |
def foo |
| 12 |
"Hello!"
|
| 13 |
end
|
| 14 |
end
|
| 15 |
|
| 16 |
# stack level too deep (SystemStackError) in 1.9
|
| 17 |
$mod = [A,A] |
| 18 |
$mod.map{|mod| wrap(mod) }.each{|m|
|
| 19 |
p Class.new{ include m }.new.foo
|
| 20 |
} |
| 21 |
# NO error in 1.9 when removing the map
|
| 22 |
$mod.each{|mod|
|
| 23 |
m = wrap(mod) |
| 24 |
p Class.new{ include m }.new.foo
|
| 25 |
} |
| 26 |
|
| 27 |
# Also an error on 'manual map'
|
| 28 |
$mod = [wrap(A),wrap(A)] |
| 29 |
$mod.each{|m|
|
| 30 |
p Class.new{ include m }.new.foo
|
| 31 |
} |
| 32 |
|
| 33 |
# But no error on mapping single-element arrays
|
| 34 |
$mod = [A] |
| 35 |
$mod.map{|mod| wrap(mod) }.each{|m|
|
| 36 |
p Class.new{ include m }.new.foo
|
| 37 |
} |
| 38 |
|
| 39 |
|