mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 14:34:39 +02:00
* vm_insnhelper.c (vm_setup_method): should not enable tail call
optimization for frames with VM_FRAME_FLAG_FINISH. [ruby-dev:46065] [Bug #6901] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7a69af7461
commit
bf797ed9b0
3 changed files with 29 additions and 1 deletions
|
@ -160,4 +160,25 @@ class TestRubyOptimization < Test::Unit::TestCase
|
|||
EOF
|
||||
assert_equal(9131, Tailcall.new.fact(3000).to_s.size, bug4082)
|
||||
end
|
||||
|
||||
def test_tailcall_with_block
|
||||
bug6901 = '[ruby-dev:46065]'
|
||||
|
||||
option = {
|
||||
tailcall_optimization: true,
|
||||
trace_instruction: false,
|
||||
}
|
||||
iseq = RubyVM::InstructionSequence.new(<<-EOF, "Bug#6901", bug6901, nil, option).eval
|
||||
def identity(val)
|
||||
val
|
||||
end
|
||||
|
||||
def delay
|
||||
-> {
|
||||
identity(yield)
|
||||
}
|
||||
end
|
||||
EOF
|
||||
assert_equal(123, delay { 123 }.call, bug6901)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue