Project

General

Profile

Bug #16632 ยป remove-verbose-warning-keyword-splat-to-positional.patch

jeremyevans0 (Jeremy Evans), 02/13/2020 09:54 PM

View differences:

test/ruby/test_keyword.rb
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
vm_args.c
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) {
    (1-1/1)