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

keyword arguments incompatibilities #2512

Closed
blanquer opened this issue Jan 24, 2015 · 2 comments
Closed

keyword arguments incompatibilities #2512

blanquer opened this issue Jan 24, 2015 · 2 comments

Comments

@blanquer
Copy link

There are a couple of things that I'm seeing that still don't match the MRI behavior on method keyword arguments.

One is the arity, which returns different results ( but I believe that this might already be tracked in #2480 ?)

The other one is the definition of the keyword types "required" vs. not . For example, required arguments are not reported as such in the .parameters call.

Here's a quick snippet that shows both things, and the difference in results:

class Foo
  def self.test( arg1: "default" , arg2: )
    puts "arg1: #{arg1.inspect}"
  end
end

m = Foo.method(:test)
puts "PARAMS: #{m.parameters.inspect}"
puts "ARITY: #{m.arity}"
bug:~ $ rvm 2.2.0
bug:~ $ ruby /tmp/test.rb
PARAMS: [[:keyreq, :arg2], [:key, :arg1]]
ARITY: 1
bug:~ $ rvm jruby-head
bug:~ $ ruby /tmp/test.rb
PARAMS: [[:key, :arg1], [:key, :arg2]]
ARITY: 0
@Who828
Copy link
Contributor

Who828 commented Jan 24, 2015

Hey, thanks for reporting the bug!
I have fixed parsing bit, so it identifies keyreq correctly but I still need to work on the arity part of the bug.

@enebo
Copy link
Member

enebo commented Apr 17, 2015

Recent commits has solved remaining issue with this snippet (e.g. arity being reported as wrong).

@enebo enebo closed this as completed Apr 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants