Skip to content

Conversation

@herwinw
Copy link
Member

@herwinw herwinw commented Dec 3, 2024

This is an attempt at a fix for #1216, but I feel like this is more of an MRI internal property and I'm not sure if this does even belong in the specs. If this should be added, we should probably extend the test cases with the other optimizations.
(I used https://github.com/ruby/ruby/pull/7931/files#diff-f12a6f58c06015b85739069cde86a0921a8f12fb9c66e05e6643f6dbcebb1a29 to even find a test case)

@trinistr
Copy link
Contributor

trinistr commented Nov 6, 2025

From .linear_time?'s description:

Note that this is a property of the ruby interpreter, not of the argument regular expression. Identical regexp can or cannot run in linear time depending on your ruby binary. Neither forward nor backward compatibility is guaranteed about the return value of this method.

However painful to leave a change uncovered, I think that testing for these small cases doesn't seem to make much sense, as there is no compatibility in any direction, and it is not a property of the language at all.

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