From f8e49e4c5ee151ec13f155dcb8dbca3b7f53fe76 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Thu, 13 Feb 2020 13:52:32 -0800 Subject: [PATCH] Remove verbose warning for treating splatted hash as positional hash This warning was added in Ruby 2.6. It isn't in 2.5, and it doesn't make sense with the direction Ruby 2.7 and 3.0 took in regards to keyword argument separation. It should be removed. --- test/ruby/test_keyword.rb | 4 ++-- vm_args.c | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 84a5cfec66..7c8eb6197e 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -520,10 +520,10 @@ def m.f4(*a) a; end assert_equal(:ok, m.f(*a, **o), '[ruby-core:83638] [Bug #10856]') o = {a: 42} - assert_warning(/splat keyword/, 'splat to mandatory') do + assert_warning('', 'splat to mandatory') do assert_equal({a: 42}, m.f1(**o)) end - assert_warning(/splat keyword/) do + assert_warning('') do assert_equal({a: 42}, m.f2(**o), '[ruby-core:82280] [Bug #13791]') end assert_warning('', 'splat to kwrest') do diff --git a/vm_args.c b/vm_args.c index 299ed16aa8..2e70ed3fcf 100644 --- a/vm_args.c +++ b/vm_args.c @@ -685,17 +685,6 @@ setup_parameters_complex(rb_execution_context_t * const ec, const rb_iseq_t * co else if (!NIL_P(keyword_hash) && RHASH_SIZE(keyword_hash) > 0) { argument_kw_error(ec, iseq, "unknown", rb_hash_keys(keyword_hash)); } - else if (kw_splat && NIL_P(keyword_hash)) { - if (RTEST(ruby_verbose)) { - VALUE path = rb_iseq_path(iseq); - VALUE line = rb_iseq_first_lineno(iseq); - VALUE label = rb_iseq_label(iseq); - rb_compile_warning(NIL_P(path) ? NULL : RSTRING_PTR(path), FIX2INT(line), - "in `%s': the last argument was passed as a single Hash", - NIL_P(label) ? NULL : RSTRING_PTR(label)); - rb_warning("although a splat keyword arguments here"); - } - } if (iseq->body->param.flags.has_block) { if (iseq->body->local_iseq == iseq) { -- 2.25.0