Skip to content

Fix Regex::Option behaviour for unnamed members#13155

Merged
straight-shoota merged 2 commits intocrystal-lang:masterfrom
straight-shoota:fix/regex-options
Mar 7, 2023
Merged

Fix Regex::Option behaviour for unnamed members#13155
straight-shoota merged 2 commits intocrystal-lang:masterfrom
straight-shoota:fix/regex-options

Conversation

@straight-shoota
Copy link
Member

The process of decoupling Regex::Option from specific lib values caused an unintended behavioural change with regards to unnamed members.

The intention was that unnamed members should continue to function for PCRE, but raise on PCRE2 as a safety mechanism to avoid unintended effects because both library versions use different option values.
More explanation in #13152 (comment)

This was originally implemented in #12802 for the original PCRE bindings and subsequently for the PCRE2 bindings in #12856. Both implementations use Enum#each to iterate the flag enum members, but that only accounts for named members and excess flag values would be ignored.

This patch fixes that to the intended behaviour and adds a spec for it.

The general subject is due to further discussion in #13152, though.

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:text kind:regression Something that used to correctly work but no longer works labels Mar 5, 2023
@straight-shoota straight-shoota self-assigned this Mar 5, 2023
@straight-shoota straight-shoota added this to the 1.8.0 milestone Mar 6, 2023
@straight-shoota straight-shoota merged commit 7584f8d into crystal-lang:master Mar 7, 2023
@straight-shoota straight-shoota deleted the fix/regex-options branch March 7, 2023 08:59
@straight-shoota straight-shoota modified the milestones: 1.8.0, 1.7.3 Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. kind:regression Something that used to correctly work but no longer works topic:stdlib:text

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants