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

alias_method not preserving UnboundMethod#parameters #839

ericmeyer opened this Issue Jul 1, 2013 · 3 comments


None yet
2 participants
Copy link

ericmeyer commented Jul 1, 2013

There seems to be a bug with alias_method. Aliasing a method does not preserve the return value of UnboundMethod#parameters.

Here is an example:

jruby-1.7.3 :001 > class Foo
jruby-1.7.3 :002?>     def abc_one(some_arg)
jruby-1.7.3 :003?>       end
jruby-1.7.3 :004?>     alias_method :abc_two, :abc_one
jruby-1.7.3 :005?>   end
 => Foo
jruby-1.7.3 :006 > Foo.instance_method(:abc_two).parameters
 => []
jruby-1.7.3 :007 > Foo.instance_method(:abc_one).parameters
 => [[:req, :some_arg]]

I would expect the return value of Foo.instance_method(:abc_two).parameters to be the [[:req, :some_arg]].

This bug exists in 1.6.8, 1.7.3 and 1.7.4.

@headius headius closed this in c84ea48 Jul 1, 2013


This comment has been minimized.

Copy link

headius commented Jul 1, 2013

Could you submit either a spec (to rubyspec/rubyspec) or a test (to MRI or our copy of MRI's tests under test/externals) for this behavior? Thanks!


This comment has been minimized.

Copy link

ericmeyer commented Jul 12, 2013

This what you were looking for?


This comment has been minimized.

Copy link

headius commented Jul 24, 2013

Looks good to me...thanks!

On Fri, Jul 12, 2013 at 2:50 PM, ericmeyer wrote:

This what you were looking for?


Reply to this email directly or view it on GitHub

alindeman added a commit to rspec/rspec-mocks that referenced this issue Oct 21, 2013

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.