summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse.y6
-rw-r--r--test/ruby/test_syntax.rb2
2 files changed, 6 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index b1ddc1b..51f7d3f 100644
--- a/parse.y
+++ b/parse.y
@@ -9809,8 +9809,10 @@ cond0(struct parser_params *p, NODE *node, int method_op, const YYLTYPE *loc)
case NODE_DOT3:
node->nd_beg = range_op(p, node->nd_beg, loc);
node->nd_end = range_op(p, node->nd_end, loc);
- if (nd_type(node) == NODE_DOT2) nd_set_type(node,NODE_FLIP2);
- else if (nd_type(node) == NODE_DOT3) nd_set_type(node, NODE_FLIP3);
+ if (nd_type(node) == NODE_DOT2 || nd_type(node) == NODE_DOT3) {
+ nd_set_type(node, nd_type(node) == NODE_DOT2 ? NODE_FLIP2 : NODE_FLIP3);
+ parser_warn(p, node, "flip-flop is deprecated");
+ }
if (!method_op && !e_option_supplied(p)) {
int b = literal_node(node->nd_beg);
int e = literal_node(node->nd_end);
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 6798543..564fc21 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -940,7 +940,9 @@ eom
eval('1 if !//')
end
assert_warn('') do
+ verbose_bak, $VERBOSE = $VERBOSE, nil
eval('1 if !(true..false)')
+ $VERBOSE = verbose_bak
end
assert_warning('') do
eval('1 if !1')