From c9ecea33dafa7aea3682f32f651fa9a6aa85b1ac Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 1 Mar 2018 04:10:25 +0000 Subject: [PATCH] parse.y: refine assign_in_cond warning * parse.y (assign_in_cond): refine a warning message for assignment of a literal in conditinal expression. [ruby-core:85872] [Bug #14562] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 2 +- test/ruby/test_rubyoptions.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parse.y b/parse.y index 5380d93b92..b2bbafe123 100644 --- a/parse.y +++ b/parse.y @@ -9585,7 +9585,7 @@ assign_in_cond(struct parser_params *p, NODE *node) if (!node->nd_value) return 1; if (is_static_content(node->nd_value)) { /* reports always */ - parser_warn(p, node->nd_value, "found = in conditional, should be =="); + parser_warn(p, node->nd_value, "found `= literal' in conditional, should be =="); } return 1; } diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 396dda1692..7c733a4d8e 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -408,7 +408,7 @@ class TestRubyOptions < Test::Unit::TestCase t.puts " end" t.puts "end" t.flush - warning = ' warning: found = in conditional, should be ==' + warning = ' warning: found `= literal\' in conditional, should be ==' err = ["#{t.path}:1:#{warning}", "#{t.path}:4:#{warning}", ]