[2.0] Incorrect arity checking for methods with kw arguments #1049

Closed
97jaz opened this Issue Sep 30, 2013 · 0 comments

1 participant

@97jaz

The following program should raise an ArgumentError:

def test(foo: 10)
  foo
end

test(3)

In the latest JRuby it instead produces 10.

On the other hand, this should not raise an argument error:

def test(foo, bar: 10)
  [foo, bar]
end

test(no: "way")

...but it does. (MRI 2.0.0p0 also got this wrong, but p247 displays correct behavior.)

@97jaz 97jaz added a commit to 97jaz/jruby that referenced this issue Sep 30, 2013
@97jaz 97jaz Fixes #1049: incorrect arity checking for kw arguments
There were two basic problems with the existing logic:
* Arguments could be treated both as kw args and as, e.g.,
optional args.
* An arity check for methods with kw arguments in the Arity class
is deferred to asignment time, but the check was not being performed
there, either.
9a214cb
@97jaz 97jaz added a commit to 97jaz/jruby that referenced this issue Oct 1, 2013
@97jaz 97jaz Fixes #1049: incorrect arity checking for kw arguments
There were two basic problems with the existing logic:
* Arguments could be treated both as kw args and as, e.g.,
optional args.
* An arity check for methods with kw arguments in the Arity class
is deferred to asignment time, but the check was not being performed
there, either.
5c5bf13
@headius headius added a commit that closed this issue Oct 1, 2013
@97jaz 97jaz Fixes #1049: incorrect arity checking for kw arguments
There were two basic problems with the existing logic:
* Arguments could be treated both as kw args and as, e.g.,
optional args.
* An arity check for methods with kw arguments in the Arity class
is deferred to asignment time, but the check was not being performed
there, either.
86a3ecf
@headius headius closed this in 86a3ecf Oct 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment