Skip to content

Keyword argument regression in JRuby 9.4 #7537

@janko

Description

@janko

Environment Information

$ jruby -v
jruby 9.4.0.0 (3.1.0) 2022-11-23 95c0ec159f OpenJDK 64-Bit Server VM 17.0.2+0 on 17.0.2+0 +jit [arm64-darwin]
$ uname -a
Darwin Jankos-MacBook-Air.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64

Expected Behavior

When I execute the following script, I expect it to execute without errors, as it does on Ruby 3.1:

class Foo
  def meth(arg:)
  end
end

class Bar < Foo
  def meth(arg:)
    something { super }
  end

  def something
    yield
  end
end

Bar.new.meth(arg: "foo")

Actual Behavior

However, I get an error instead:

ArgumentError: missing keyword: arg
       meth at program.rb:2
       meth at program.rb:8
  something at program.rb:12
       meth at program.rb:8
     <main> at program.rb:16
... 6 levels...

They key combination is inheritance plus a method that yields and calls super without arguments. If I remove something and just call super directly, the error doesn't happen.

This error happened originally in the Shrine test suite.

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