Remove unnecessary checks for empty kw splat#4404
Conversation
These two checks are surrounded by an if that ensures the callsite is not a kw splat.
jeremyevans
left a comment
There was a problem hiding this comment.
This should be correct as long as the rb_callinfo VM_CALL_KW_SPLAT flag is always set if calling->kw_splat is true. Based on the comment in CALLER_REMOVE_EMPTY_KW_SPLAT, that isn't always true, but it should only be false in case CALLER_REMOVE_EMPTY_KW_SPLAT has already been called, and calling CALLER_REMOVE_EMPTY_KW_SPLAT is idempotent. So I think this is a correct fix.
Related to this, the part of the comment in CALLER_REMOVE_EMPTY_KW_SPLAT regarding adding empty hashes back has been inaccurate since Ruby 3.0 (it was true in Ruby 2.7), I'll fix that.
|
Hmm actually this change introduces a behavior change in the following script: def foo; end
foo(*[Hash.ruby2_keywords_hash({})])I guess one could also get an empty keywords hash by clearing the one passed in as argument to a |
These two checks are surrounded by an if that ensures the
call site is not a kw splat call site.