summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-24 16:00:27 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-24 16:00:27 +0000
commit2d414cb1acb6166643aa7b756ad8e525ef25ddd1 (patch)
tree7c3ce994c71d79c9ab1fdb6dfbb2cade620984bb /test
parent2bedc514725bd4ec27e6fdc3aed485badc1a3ec0 (diff)
merge revision(s) 61587,61617,61618: [Backport #14273]
compile.c: next label * compile.c (compile_next): label for jump to the end of block is removable. 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@62911 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 e1a035704e..6d8d8f5f32 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1134,6 +1134,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