Skip to content

"[2].to_enum.find_index(2.0)" returns 0 (to match MRI behavior)#3325

Merged
kares merged 2 commits into
jruby:masterfrom
alexdowad:fix_fixnum_equals
Sep 16, 2015
Merged

"[2].to_enum.find_index(2.0)" returns 0 (to match MRI behavior)#3325
kares merged 2 commits into
jruby:masterfrom
alexdowad:fix_fixnum_equals

Conversation

@alexdowad

Copy link
Copy Markdown
Contributor

This is a bug which I found while testing one of my gems on JRuby. Please have a look!

alexdowad added a commit to hamstergem/hamster that referenced this pull request Sep 14, 2015
I have sent a potential fix to JRuby: jruby/jruby#3325

If the bug is fixed in JRuby, we can later remove this.
alexdowad added a commit to immutable-ruby/immutable-ruby that referenced this pull request Sep 14, 2015
I have sent a potential fix to JRuby: jruby/jruby#3325

If the bug is fixed in JRuby, we can later remove this.
@kares

kares commented Sep 15, 2015

Copy link
Copy Markdown
Member

very najs, I think @eregon would prefer having the spec/ruby/core/enumerable/find_index_spec.rb updated in a separate commit?

@eregon

eregon commented Sep 15, 2015

Copy link
Copy Markdown
Contributor

Yes, that would be nicer to merge back upstream (essentially the commit name would reflect just the spec not the "fix" part)

The 'equals' method is used as an equivalent of `self#==`. `Fixnum#==` converts
Float arguments, so `RubyFixnum.equals` should do so too.

`RubyFixnum.op_equalOther` also converts `Bignum`s which are passed in, so maybe
`RubyFixnum.equals` should do so too. But then again, when can a `Bignum` ever be
equal to a `Fixnum`? In MRI, I'm pretty sure that is impossible, but maybe JRuby
doesn't always "fixize" `Bignum`s?

That is a question for someone else to answer. For now, this fixes a bug.
@alexdowad

Copy link
Copy Markdown
Contributor Author

You got it. Have a look now.

kares added a commit that referenced this pull request Sep 16, 2015
"[2].to_enum.find_index(2.0)" returns 0 (to match MRI behavior)
@kares kares merged commit df012fa into jruby:master Sep 16, 2015
@enebo enebo modified the milestone: Non-Release May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants