summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2021-02-11 12:52:11 +0900
committernagachika <nagachika@ruby-lang.org>2021-02-11 12:52:11 +0900
commitc271c7a225c6175f56f00b785e3034cb4a2b7658 (patch)
tree407a214aca1b4b3262f1226ce0a447332c06a980 /test
parent29bc77f780bbefca60724e52129f5229aa373551 (diff)
merge revision(s) ce7a053475cbebfb2f3e5ed6614e0ba631541917,1cbb1f1720127b0b34b38c77e27b51b182008699: [Backport #16695]
Adjust sp for `x = false; y = (return until x unless x)` [Bug #16695] --- compile.c | 8 +++----- test/ruby/test_syntax.rb | 9 +++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) test/ruby/test_syntax.rb: avoid "warning: assigned but unused variable" --- test/ruby/test_syntax.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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 f628dc3fba..86417ba12f 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1374,6 +1374,15 @@ eom
assert_nil obj.test
end
+ def test_assignment_return_in_loop
+ obj = Object.new
+ def obj.test
+ x = nil
+ _y = (return until x unless x)
+ end
+ assert_nil obj.test, "[Bug #16695]"
+ end
+
def test_method_call_location
line = __LINE__+5
e = assert_raise(NoMethodError) do