Skip to content

Conversation

jeremyevans
Copy link
Contributor

Beginless ranges previously raised TypeError for this case,
except for string ranges, which had unexpected behavior:

  ('a'..'z').include?('ww') # false
  (..'z').include?('ww') # previously true, now TypeError

Use of include? with endless ranges could previously result
in an infinite loop.

Fixes [Bug #18580]

@jeremyevans jeremyevans requested a review from nobu August 19, 2022 21:44
@jeremyevans
Copy link
Contributor Author

@nobu Please let me know if the second commit is what you had in mind for the function splitting.

Beginless ranges previously raised TypeError for this case,
except for string ranges, which had unexpected behavior:

  ('a'..'z').include?('ww') # false
  (..'z').include?('ww') # previously true, now TypeError

Use of include? with endless ranges could previously result
in an infinite loop.

This splits off a range_string_cover_internal function from
range_include_internal.

Fixes [Bug #18580]
@jeremyevans jeremyevans force-pushed the beginless-endless-range-include-18580 branch from 722a4d4 to f6107c5 Compare November 24, 2022 22:13
@jeremyevans jeremyevans merged commit 04a92a6 into ruby:master Nov 24, 2022
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.

1 participant