From df93a07990373ff1595ebc93961c0e10301b2f5e Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 22 Nov 2015 07:53:37 +0000 Subject: compile.c: move logop DCE * compile.c (iseq_peephole_optimize): remove unreachable code chunk after jump/leave. * parse.y: move dead code elimination of logical operation to compile.c. not to warn logical operation of literal constants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_syntax.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby/test_syntax.rb') diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 985a46b532..e2cd389a07 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -633,6 +633,18 @@ eom assert_valid_syntax("a\n&.foo") end + def test_no_warning_logop_literal + assert_warning("") do + eval("true||raise;nil") + end + assert_warning("") do + eval("false&&raise;nil") + end + assert_warning("") do + eval("''||raise;nil") + end + end + private def not_label(x) @result = x; @not_label ||= nil end -- cgit v1.2.3