Skip to content

Use non-range cover logic for eqq and include#7138

Merged
headius merged 1 commit intojruby:jruby-9.3from
headius:range_cover_eqq
Mar 17, 2022
Merged

Use non-range cover logic for eqq and include#7138
headius merged 1 commit intojruby:jruby-9.3from
headius:range_cover_eqq

Conversation

@headius
Copy link
Member

@headius headius commented Mar 14, 2022

This code has for years mistakenly dispatched to the full cover?
logic, which considers intersecting ranges as being covered. The
logic in CRuby, however, only uses a small part of the cover logic
that does not accept ranges. The naming of the methods (in CRuby
it's r_cover_p, and in JRuby that got mapped to the full cover_p
method instead of the equivalent rangeInclude method) probably
was confusing, or early in JRuby development CRuby's r_cover_p and
our cover_p were equivalent and that changed over time in CRuby.

This also eliminates a dynamic dispatch to cover? that does not
exist in CRuby.

Fixes #7137

@headius headius added this to the JRuby 9.3.4.0 milestone Mar 14, 2022
@headius
Copy link
Member Author

headius commented Mar 14, 2022

Ok something is clearly not right with this patch. Will continue to investigate.

@headius headius changed the base branch from master to jruby-9.3 March 17, 2022 07:19
@headius
Copy link
Member Author

headius commented Mar 17, 2022

Created the PR wrong again, which is probably why it failed. 🤦‍♂️

This code has for years mistakenly dispatched to the full cover?
logic, which considers intersecting ranges as being covered. The
logic in CRuby, however, only uses a small part of the cover logic
that does not accept ranges. The naming of the methods (in CRuby
it's r_cover_p, and in JRuby that got mapped to the full cover_p
method instead of the equivalent rangeInclude method) probably
was confusing, or early in JRuby development CRuby's r_cover_p and
our cover_p were equivalent and that changed over time in CRuby.

This also eliminates a dynamic dispatch to `cover?` that does not
exist in CRuby.

Fixes jruby#7137
@headius headius merged commit f47cc27 into jruby:jruby-9.3 Mar 17, 2022
@headius headius deleted the range_cover_eqq branch March 17, 2022 14:46
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.

Range#=== should not accept range argument

1 participant