This shows locations in places it didn't before, such as for
proc calls, and fixes the location for super calls.
This requires making iseq_location non-static and MJIT exported,
which I hope will not cause problems.
This reverts the changes to parse.y in
a5b37262524ac39d2af13eea174486370a581c23 as they are not actually
needed and cause the warning for duplicate hash keys to not be
emitted.
For methods that accept keyword arguments but do not accept a
keyword splat, if a keyword splat is passed, or keywords are
used with a non-symbol key, check the hash. If the hash contains
all symbols, keep the same behavior as before. If the hash
contains all non-symbols, move the hash to the last positional
hash and warn. If the hash contains symbols and non-Symbols, split
the hash and use the symbol keys for the keyword hash and non-symbol
keys for the positional hash and warn.
The on_params hook will use :nil as the keyword rest argument.
There is a new on_nokw_param hook as well.
This fixes a type issue in the previous code, where an ID was
passed where a VALUE was the declared type. The symbol :nil is
passed instead of the id.
This syntax means the method should be treated as a method that
uses keyword arguments, but no specific keyword arguments are
supported, and therefore calling the method with keyword arguments
will raise an ArgumentError. It is still allowed to double splat
an empty hash when calling the method, as that does not pass
any keyword arguments.
This restores compatibility with Ruby 2.6, splitting the last
positional hash into positional and keyword arguments if it
contains both symbol and non-symbol keys. However, in this case
it will warn, as the behavior in Ruby 3 will be to not split the
hash and keep it as a positional argument.
This does not affect the handling of mixed symbol and non-symbol
keys in bare keywords. Those are still treated as keywords now,
as they were before this patch. This results in different
behavior than Ruby 2.6, which would split the bare keywords and
use the non-Symbol keys as a positional arguments.
Now that keyword splats accept non-Symbols, the type of exception
changes.
Previously, a TypeError (hash key "k1" is not a Symbol) was raised
for this test, but now an ArgumentError (unknown keyword: "k1") is
raised.
If all keys are not symbols, then the non-symbol keys would not
be treated as keywords in previous versions. It doesn't make
sense to treat these hashes as keywords to break compatibility and
warn about behavior changes in Ruby 2.7 when the Ruby 3.0 behavior
will be the same as the Ruby 2.6 for these hashes.
Treat the ** syntax as passing a copy of the hash as the last
positional argument. If the hash being double splatted is empty, do
not add a positional argument.
Remove rb_no_keyword_hash, no longer needed.