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

Array#min doesn't respect monkey patching #3944

Closed
chrisseaton opened this issue May 31, 2016 · 2 comments
Closed

Array#min doesn't respect monkey patching #3944

chrisseaton opened this issue May 31, 2016 · 2 comments
Labels
Milestone

Comments

@chrisseaton
Copy link
Contributor

Environment

master

p [1, 2, 3].min

class Fixnum
  alias_method :old_cmp, :<=>
  def <=>(other)
    -old_cmp(other)
  end
end

p [1, 2, 3].min

Expected Behavior

1
3

Actual Behavior

1
1

I see this TODO

// TODO: check for overwritten <=> on Fixnum and String
, but it looks like it's been forgotten about and this broken behaviour has gone into the release.

@headius
Copy link
Member

headius commented May 31, 2016

I did not consider the TODO important enough to finish before 9.1, especially since we first need a better mechanism to check for overridden methods without doing a lookup. It was not forgotten...just unlikely to ever be reported by someone who isn't also working on a Ruby implementation.

@eregon
Copy link
Member

eregon commented Jun 15, 2016

I think bccf82e from @enebo might address this :)

@enebo enebo added this to the JRuby 9.1.3.0 milestone Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants