Skip to content

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

@heisee

Description

@heisee

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions