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

Comments

Projects
None yet
3 participants
@blanquer
Copy link

commented Jan 24, 2015

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

commented Apr 17, 2015

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

@enebo enebo closed this Apr 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.