Hash cleaned when used as named parameters (JRUBY_OPTS=--2.0) #1403

Closed
slowjack2k opened this Issue Jan 14, 2014 · 5 comments

Projects

None yet

4 participants

@slowjack2k

Hi,

I did try jruby-1.7.10,

  • MacOS
  • Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)

Some of my project spec's did fail and with jirb (export JRUBY_OPTS=--2.0) I could narrow it down to this example

def foo(bar: nil)
end

a = {bar: 1}

foo a

a.inspect # output {}

jruby clears the hash. MRI does not clear the hash.

@headius
Member
headius commented Jan 14, 2014

Confirmed. Same behavior on master, too.

@headius
Member
headius commented Jan 14, 2014

Compiled and interpreter both exhibit this behavior.

@enebo
Member
enebo commented Jan 14, 2014

This is not running on IR properly either

@headius
Member
headius commented Jan 14, 2014

Ahh, kwargs still are not implemented in the compiler; so only interp and IR need fix.

I could not get the example to run in IR...raises arity error.

@headius headius added a commit that referenced this issue Jan 14, 2014
@headius headius Duplicate kwargs hash before assignment logic. Fixes ##1403.
Note that this implementation is much more costly than it should
be since it mutates the hash while it assigns variables. The new
duping makes it even more costly, but avoids the damage it caused
to the incoming hash.
7631cfc
@headius headius closed this Jan 14, 2014
@subbuss
Contributor
subbuss commented Jan 15, 2014

27b02be indicates that I am yet to fix up check_arity_instr for kwargs. Will take a look tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment