summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-22 07:53:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-22 07:53:37 +0000
commit7dc4929214e608f52774cd026ea8cc173e49e6d1 (patch)
treefc323ff2449a0139c6f97472dba30e3870cc4503 /test/ruby
parent792c822ec441a9a061a2c74ddd970005fab33ab6 (diff)
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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_syntax.rb12
1 files changed, 12 insertions, 0 deletions
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