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

Calling super with two "_" params ignores the value of the second #4219

Closed
heisee opened this issue Oct 11, 2016 · 3 comments
Closed

Calling super with two "_" params ignores the value of the second #4219

heisee opened this issue Oct 11, 2016 · 3 comments
Milestone

Comments

@heisee
Copy link

heisee commented Oct 11, 2016

Hello JRuby team,

whit this code

class A
  def x(args1, args2={})
    puts args1
    puts args2
  end
end

class B < A
  def x(_,_)
    super
  end
end

B.new.x(42,43=>44)

in MRI Ruby 2.3 and JRuby 1.7 it prints

42
{43=>44}

while in JRuby 9.1.5.0 it prints

42
{}

So, using the "_" hides the second param to be used when super is called.

If the definition of x in B uses named params like

  def x(a, b)

it works as expected.

Environment

  • jruby -v:
    jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 25.91-b14 on 1.8.0_91-b14 +jit [linux-x86_64]
  • this can be reproduced in plain irb easily.
@heisee heisee changed the title Unexpected behaviour when calling super while two "_" params are used Calling super with two "_" params ignores the value of the second Oct 11, 2016
@k77ch7
Copy link
Contributor

k77ch7 commented Feb 27, 2017

This works properly in jruby 9.1.8.0-SNAPSHOT (2.3.1) 2017-02-27 ffb61b4 and jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae.

@enebo enebo added this to the JRuby 9.1.8.0 milestone Feb 27, 2017
@enebo
Copy link
Member

enebo commented Feb 27, 2017

@k77ch7 thanks for letting us know. Marking against this upcoming release so anyone who cares can see it has been fixed.

@enebo enebo closed this as completed Feb 27, 2017
@heisee
Copy link
Author

heisee commented Feb 27, 2017

cool, thanks!

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

No branches or pull requests

3 participants