[前][次][番号順一覧][スレッド一覧]

ruby-changes:50487

From: nobu <ko1@a...>
Date: Thu, 1 Mar 2018 13:10:31 +0900 (JST)
Subject: [ruby-changes:50487] nobu:r62620 (trunk): parse.y: refine assign_in_cond warning

nobu	2018-03-01 13:10:25 +0900 (Thu, 01 Mar 2018)

  New Revision: 62620

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62620

  Log:
    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]

  Modified files:
    trunk/parse.y
    trunk/test/ruby/test_rubyoptions.rb
Index: test/ruby/test_rubyoptions.rb
===================================================================
--- test/ruby/test_rubyoptions.rb	(revision 62619)
+++ test/ruby/test_rubyoptions.rb	(revision 62620)
@@ -408,7 +408,7 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L408
       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}",
             ]
Index: parse.y
===================================================================
--- parse.y	(revision 62619)
+++ parse.y	(revision 62620)
@@ -9585,7 +9585,7 @@ assign_in_cond(struct parser_params *p, https://github.com/ruby/ruby/blob/trunk/parse.y#L9585
     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;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]