FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[fix] Bignum#eql?: use type-strict comparison (not ==) by kares · Pull Request #9336 · jruby/jruby · GitHub

/ jruby Public

[fix] Bignum#eql?: use type-strict comparison (not ==) - #9336

Merged
headius merged 1 commit into
jruby:jruby-10.0from
kares:bignum-eql-10
Mar 28, 2026
Merged

[fix] Bignum#eql?: use type-strict comparison (not ==)#9336
headius merged 1 commit into
jruby:jruby-10.0from
kares:bignum-eql-10

Conversation

kares commented Mar 28, 2026
edited
Loading

Copy link
Copy Markdown
Member

RubyBignum overrode eql_p to delegate to op_equal (==), which accepts Floats and Rationals. In Ruby, eql? must be type-strict: (2**100).eql?((2**100).to_f) should return false.

Remove the override so the parent RubyNumeric.eql_p handles it correctly with a getClass() check before value comparison.

kares changed the title [fix] Bignum#eql?: use type-strict comparison not == [fix] Bignum#eql?: use type-strict comparison (not ==) Mar 28, 2026
kares changed the base branch from master to jruby-10.0 March 28, 2026 15:08
RubyBignum overrode eql_p to delegate to op_equal (==), which
accepts Floats and Rationals. In Ruby, eql? must be type-strict:
(2**100).eql?((2**100).to_f) should return false.

Remove the override so the parent RubyNumeric.eql_p handles it
correctly with a getClass() check before value comparison.
kares added this to the JRuby 10.0.5.0 milestone Mar 28, 2026

headius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Consider moving specs to ruby/spec.

headius merged commit 4fb0bbe into jruby:jruby-10.0 Mar 28, 2026
304 of 307 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL