diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-22 02:25:16 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-22 02:25:16 +0000 |
commit | bf797ed9b094289d79b485fd3794cb40acb368b0 (patch) | |
tree | c28c6a4418907fc542d7e66f6f89a5273b2c4e71 /test | |
parent | 7a69af746135a2ecfc21cf717c4a4b217283ca15 (diff) | |
download | ruby-bf797ed9b094289d79b485fd3794cb40acb368b0.tar.gz |
* 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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_optimization.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index ed604e7bc3..1b0c730996 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -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 |