Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
4 participants
@slowjack2k
Copy link

slowjack2k commented Jan 14, 2014

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

This comment has been minimized.

Copy link
Member

headius commented Jan 14, 2014

Confirmed. Same behavior on master, too.

@headius

This comment has been minimized.

Copy link
Member

headius commented Jan 14, 2014

Compiled and interpreter both exhibit this behavior.

@enebo

This comment has been minimized.

Copy link
Member

enebo commented Jan 14, 2014

This is not running on IR properly either

@headius

This comment has been minimized.

Copy link
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 added a commit that referenced this issue Jan 14, 2014

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.

@headius headius closed this Jan 14, 2014

@subbuss

This comment has been minimized.

Copy link
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
You can’t perform that action at this time.