alias_method not preserving UnboundMethod#parameters #839

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

Projects

None yet

2 participants

@ericmeyer

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
Member
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

This what you were looking for?

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

@headius
Member
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/jruby/jruby/issues/839#issuecomment-20900157
.

@alindeman alindeman added a commit to rspec/rspec-mocks that referenced this issue Oct 21, 2013
@alindeman alindeman Works around jruby/jruby#839 8f3bcf9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment