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

ruby-changes:43322

From: nobu <ko1@a...>
Date: Mon, 13 Jun 2016 20:50:14 +0900 (JST)
Subject: [ruby-changes:43322] nobu:r55396 (trunk): parse.y: no named capture conflict warnings

nobu	2016-06-13 20:50:09 +0900 (Mon, 13 Jun 2016)

  New Revision: 55396

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

  Log:
    parse.y: no named capture conflict warnings
    
    * parse.y (reg_named_capture_assign_iter): remove named capture
      conflict warnings.  it is just annoying rather than useful.
      [ruby-core:75416] [Bug #12359]

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ruby/test_parse.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55395)
+++ ChangeLog	(revision 55396)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jun 13 20:50:07 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (reg_named_capture_assign_iter): remove named capture
+	  conflict warnings.  it is just annoying rather than useful.
+	  [ruby-core:75416] [Bug #12359]
+
 Mon Jun 13 20:04:00 2016  Kenta Murata  <mrkn@m...>
 
 	* numeric.c (rb_int_digits, rb_fix_digits, rb_int_digits_bigbase):
Index: test/ruby/test_parse.rb
===================================================================
--- test/ruby/test_parse.rb	(revision 55395)
+++ test/ruby/test_parse.rb	(revision 55396)
@@ -869,9 +869,9 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L869
 
   def test_named_capture_conflict
     a = 1
-    assert_warning(/named capture conflict/) {eval("a = 1; /(?<a>)/ =~ ''")}
+    assert_warning('') {eval("a = 1; /(?<a>)/ =~ ''")}
     a = "\u{3042}"
-    assert_warning(/#{a}/) {eval("#{a} = 1; /(?<#{a}>)/ =~ ''")}
+    assert_warning('') {eval("#{a} = 1; /(?<#{a}>)/ =~ ''")}
   end
 
 =begin
Index: parse.y
===================================================================
--- parse.y	(revision 55395)
+++ parse.y	(revision 55396)
@@ -10616,10 +10616,6 @@ reg_named_capture_assign_iter(const Onig https://github.com/ruby/ruby/blob/trunk/parse.y#L10616
         return ST_CONTINUE;
     }
     var = intern_cstr(s, len, enc);
-    if (dvar_defined(var) || local_id(var)) {
-        rb_warning1("named capture conflicts a local variable - %"PRIsWARN,
-                    rb_id2str(var));
-    }
     node = newline_node(node_assign(assignable(var, 0), NEW_LIT(ID2SYM(var))));
     succ = arg->succ_block;
     if (!succ) succ = NEW_BEGIN(0);

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

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