diff options
| author | Jeremy Evans <code@jeremyevans.net> | 2019-09-05 12:25:14 -0700 |
|---|---|---|
| committer | Jeremy Evans <code@jeremyevans.net> | 2019-09-05 17:47:12 -0700 |
| commit | e7274a8ec43b5b20e42842e730dbabae58d2e6a2 (patch) | |
| tree | 943f799d259e6c89454742ff5f28bd592ae35aed /spec/ruby/core/class | |
| parent | d1ef73b59cede58f2173fa0f4ff7480a820f25d6 (diff) | |
Convert empty keyword hash to required positional argument and warn
In general, we want to ignore empty keyword hashes. The only case
where we want to allow them for backwards compatibility is when
they are necessary to satify the final required positional argument.
In that case, we want to not ignore them, but we do want to warn,
as that will be going away in Ruby 3.
This commit implements this support for regular methods and
attr_writer methods.
In order to allow send to forward arguments correctly, send no
longer removes empty keyword hashes. It is the responsibility of
the final method to remove the empty keyword hashes now. This
change was necessary as otherwise send could remove the empty
keyword hashes before the regular or attr_writer methods could
move them to required positional arguments.
For completeness, add tests for keyword handling regular
methods calls.
This makes rb_warn_keyword_to_last_hash non-static in vm_args.c
so it can be reused in vm_insnhelper.c, and also moves declarations
before statements in the rb_warn_* functions in vm_args.c.
Diffstat (limited to 'spec/ruby/core/class')
0 files changed, 0 insertions, 0 deletions
