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

Closed
ericmeyer opened this issue Jul 1, 2013 · 3 comments
Closed

alias_method not preserving UnboundMethod#parameters #839

ericmeyer opened this issue Jul 1, 2013 · 3 comments
Labels
Milestone

Comments

@ericmeyer
Copy link

@ericmeyer 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
@headius
Copy link
Member

@headius 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!

@ericmeyer
Copy link
Author

@ericmeyer ericmeyer commented Jul 12, 2013

This what you were looking for?

https://github.com/rubyspec/rubyspec/pull/238

@headius
Copy link
Member

@headius headius commented Jul 24, 2013

Looks good to me...thanks!

On Fri, Jul 12, 2013 at 2:50 PM, ericmeyer notifications@github.com wrote:

This what you were looking for?

rubyspec/rubyspec#238 https://github.com/rubyspec/rubyspec/issues/238


Reply to this email directly or view it on GitHubhttps://github.com//issues/839#issuecomment-20900157
.

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
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants