Skip to content

Remove unnecessary cast of kwargs#7984

Merged
headius merged 1 commit intojruby:masterfrom
headius:premature_kwargs_cast
Oct 26, 2023
Merged

Remove unnecessary cast of kwargs#7984
headius merged 1 commit intojruby:masterfrom
headius:premature_kwargs_cast

Conversation

@headius
Copy link
Member

@headius headius commented Oct 26, 2023

The intent here was to pass in what might be kwargs if the keyword flag was set, indicating that kwargs were being passed in. This assumption seems ok so I'm not sure why it doesn't hold. In any case, the cast here is unnecessary and the IRubyObject form will return null for non-RubyHashes.

The code that triggered this does deal directly with kwargs, but as a kwrest, forwarding it through a block:

https://github.com/rails/rails/blob/v7.1.1/activesupport/lib/active_support/testing/time_helpers.rb#L176-L183

This could indicate JRuby failing to pass along a keyword flag when forwarding kwrest.

The additional changes here are:

  • Fall back on non-kwargs behavior if last arg turns out not to be a hash.
  • Remove a redundant reset of the callInfo that governs keyword- passing.

Fixes #7982

@headius headius added this to the JRuby 9.4.5.0 milestone Oct 26, 2023
The intent here was to pass in what might be kwargs if the keyword
flag was set, indicating that kwargs were being passed in. This
assumption seems ok so I'm not sure why it doesn't hold. In any
case, the cast here is unnecessary and the IRubyObject form will
return null for non-RubyHashes.

The code that triggered this does deal directly with kwargs, but
as a kwrest, forwarding it through a block:

https://github.com/rails/rails/blob/v7.1.1/activesupport/lib/active_support/testing/time_helpers.rb#L176-L183

This could indicate JRuby failing to pass along a keyword flag
when forwarding kwrest.

The additional changes here are:

* Fall back on non-kwargs behavior if last arg turns out not to be
  a hash.
* Remove a redundant reset of the `callInfo` that governs keyword-
  passing.

Fixes jruby#7982
@headius headius force-pushed the premature_kwargs_cast branch from 9ca8271 to 74fa59e Compare October 26, 2023 05:58
@headius headius merged commit 4a0641b into jruby:master Oct 26, 2023
@headius headius deleted the premature_kwargs_cast branch October 26, 2023 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error using ActiveSupport::Testing::TestHelpers (7.1.1) on jruby-9.4.4.0

1 participant