From f279c3a37602f57426d144d32c464caf1bd05227 Mon Sep 17 00:00:00 2001 From: usa Date: Sun, 28 Feb 2021 15:04:13 +0000 Subject: merge revision(s) 01b3a380: [Backport #11143][Backport #15932] Fix wrong "void value expression" error * parse.y (value_expr_check): if either of then or else statements is not a void value expression, the whole if is not also a void value expression. [Bug #15932] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_syntax.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 4e403a9ffd..3e77f44efe 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1306,6 +1306,12 @@ eom assert_valid_syntax('obj::foo (1) {}') end + def test_value_expr_in_condition + mesg = /void value expression/ + assert_syntax_error("tap {a = (true ? next : break)}", mesg) + assert_valid_syntax("tap {a = (true ? true : break)}") + end + private def not_label(x) @result = x; @not_label ||= nil end -- cgit v1.2.3