parse.y: serial comparisons

* parse.y (rel_expr): warn sequence of comparisons, which would be
  probably unintentional.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-10-18 13:08:53 +00:00
parent c1c3d07332
commit 4a375f3ef5
2 changed files with 23 additions and 5 deletions

View file

@ -1069,6 +1069,14 @@ x = __ENCODING__
assert_equal(1.3, o.x)
end
def test_serial_comparison
assert_warning(/comparison '<' after/) do
$VERBOSE = true
x = 1
eval("if false; 0 < x < 2; end")
end
end
=begin
def test_past_scope_variable
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}