summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-11-14 22:14:35 -0800
committerJeremy Evans <code@jeremyevans.net>2020-11-15 15:25:32 -0800
commitf5bb9115a7f69c32089b9b970933c3507fb9f82b (patch)
tree14f288e98071003bb01a8b6da8679b37075279cc /parse.y
parent45fd53e0a22a2e3a870181cc2bfc74abcc5cac79 (diff)
Use more specific warning for ambiguous slash
Fixes [Bug #17124]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3767
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y7
1 files changed, 6 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 4d9ca70104..27da6bdcf9 100644
--- a/parse.y
+++ b/parse.y
@@ -7788,7 +7788,12 @@ static int
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