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
Closed

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

slowjack2k opened this issue Jan 14, 2014 · 5 comments
Milestone

Comments

@slowjack2k
Copy link

@slowjack2k 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
Copy link
Member

@headius headius commented Jan 14, 2014

Confirmed. Same behavior on master, too.

@headius
Copy link
Member

@headius headius commented Jan 14, 2014

Compiled and interpreter both exhibit this behavior.

@enebo
Copy link
Member

@enebo enebo commented Jan 14, 2014

This is not running on IR properly either

@headius
Copy link
Member

@headius 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
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
Copy link
Contributor

@subbuss 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants