summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 08:28:48 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-16 08:28:48 +0000
commit38aa1376664f217cbbf74db0f49c8eebe098156a (patch)
treea89a7dfe0c605699df128d838d1ca531be7d1f4f /test
parentd3eeb14db743736428b79ddc4c1d3d8026f15d6f (diff)
merge revision(s) 61617,61618: [Backport #14273]
compile.c: remove more unreachable chunk * compile.c (remove_unreachable_chunk): remove beyond labels to be removed. compile.c: fix stack consistency error * compile.c (iseq_peephole_optimize): fix stack consistency error from return in loop, by adding extra `pop` when replacing `jump` with `leave`, which is never reached but needed to adjust sp calculation. [ruby-core:84589] [Bug #14273] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index aa82f52987..8bf1627f3b 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1128,6 +1128,15 @@ eom
assert_equal(:begin, result)
end
+ def test_return_in_loop
+ obj = Object.new
+ def obj.test
+ x = nil
+ return until x unless x
+ end
+ assert_nil obj.test
+ end
+
private
def not_label(x) @result = x; @not_label ||= nil end