Skip to content

Range#eql? returns incorrect result for float vs int #3956

@djberg96

Description

@djberg96
>ruby -v
jruby 9.1.1.0 (2.3.0) 2016-05-19 fe84e89 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64]

The docs for Range#eql? in MRI say a Range object is eql? if start1 && start2 are eql? and end1 && end2 are eql? However, it seems JRuby is treating a float as an int:

Range.new(1.0, 25).eql?(Range.new(1, 25)) # true, but should be false

Since 1.eql?(1.0) is false, the above should be false as well.

Courtesy of berger_spec.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions