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

ruby-changes:63609

From: Jeremy <ko1@a...>
Date: Mon, 16 Nov 2020 08:25:53 +0900 (JST)
Subject: [ruby-changes:63609] f5bb9115a7 (master): Use more specific warning for ambiguous slash

https://git.ruby-lang.org/ruby.git/commit/?id=f5bb9115a7

From f5bb9115a7f69c32089b9b970933c3507fb9f82b Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Sat, 14 Nov 2020 22:14:35 -0800
Subject: Use more specific warning for ambiguous slash

Fixes [Bug #17124]

diff --git a/parse.y b/parse.y
index 4d9ca70..27da6bd 100644
--- a/parse.y
+++ b/parse.y
@@ -7788,7 +7788,12 @@ static int https://github.com/ruby/ruby/blob/trunk/parse.y#L7788
 arg_ambiguous(struct parser_params *p, char c)
 {
 #ifndef RIPPER
-    rb_warning1("ambiguous first argument; put parentheses or a space even after `%c' operator", WARN_I(c));
+    if (c == '/') {
+        rb_warning1("ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `%c' operator", WARN_I(c));
+    }
+    else {
+        rb_warning1("ambiguous first argument; put parentheses or a space even after `%c' operator", WARN_I(c));
+    }
 #else
     dispatch1(arg_ambiguous, rb_usascii_str_new(&c, 1));
 #endif
-- 
cgit v0.10.2


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

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