From 3ee0648dc7a5465b2cbadd7246fc2edbd676d759 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 18 Apr 2019 21:56:55 +0000 Subject: io.c: warn non-nil $, * array.c (rb_ary_join_m): warn use of non-nil $,. * io.c (rb_output_fs_setter): warn when set to non-nil value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'array.c') diff --git a/array.c b/array.c index 45ca8e4bcd..91859cbc23 100644 --- a/array.c +++ b/array.c @@ -2358,11 +2358,11 @@ rb_ary_join_m(int argc, VALUE *argv, VALUE ary) { VALUE sep; - if (rb_check_arity(argc, 0, 1) == 0) { - sep = rb_output_fs; - } - else if (NIL_P(sep = argv[0])) { + if (rb_check_arity(argc, 0, 1) == 0 || NIL_P(sep = argv[0])) { sep = rb_output_fs; + if (!NIL_P(sep)) { + rb_warn("$, is set to non-nil value"); + } } return rb_ary_join(ary, sep); -- cgit v1.2.3