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

Range#overlaps? error when comparing beginless ranges #44755

Closed
donny741 opened this issue Mar 23, 2022 · 3 comments · Fixed by #44757
Closed

Range#overlaps? error when comparing beginless ranges #44755

donny741 opened this issue Mar 23, 2022 · 3 comments · Fixed by #44757

Comments

@donny741
Copy link
Contributor

Steps to reproduce

(1..5).overlaps?(..10)
(..5).overlaps?(..10)

Expected behavior

It returns true

Actual behavior

It raises a RangeError: cannot get the first element of beginless range

System configuration

Rails version: 7

Ruby version: 3.0.2

@ghiculescu
Copy link
Member

Thanks for the report, do you want to try and make a PR with a fix? It would be in here https://github.com/rails/rails/blob/main/activesupport/lib/active_support/core_ext/range/overlaps.rb and tests here https://github.com/rails/rails/blob/main/activesupport/test/core_ext/range_ext_test.rb#L52

@donny741
Copy link
Contributor Author

Sure!

@jonathanhefner
Copy link
Member

jonathanhefner commented Mar 23, 2022

Fixed by #44757.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants