Skip to content

JRuby accepts wrong method arguments when mixing positional with defaults and keywords #4186

@ivoanjo

Description

@ivoanjo

Environment

Running jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 OpenJDK 64-Bit Server VM 25.91-b14 on 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14 [linux-x86_64] on Linux maruchan 4.8.0-16-generic #17-Ubuntu SMP Thu Sep 22 22:48:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux.

Expected Behavior

Example code:

def foo(a = 'default a', b:)
  [a, b]
end  

def bar
  foo(a: 'some value', b: 'some value')
end

bar

Output in MRI 2.3.1:

ArgumentError: unknown keyword: a

Actual Behavior

Output in JRuby (return from function)

["default a", "some value"]

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