Skip to content

[fix] MatchData#deconstruct_keys: include non-participating captures#9335

Merged
headius merged 1 commit intojruby:jruby-10.0from
kares:deconstruct-keys-10
Mar 28, 2026
Merged

[fix] MatchData#deconstruct_keys: include non-participating captures#9335
headius merged 1 commit intojruby:jruby-10.0from
kares:deconstruct-keys-10

Conversation

@kares
Copy link
Copy Markdown
Member

@kares kares commented Mar 28, 2026

JRuby skipped named capture groups that did not participate in the match (value is nil).

With nil argument, such keys were omitted entirely. With explicit keys, iteration stopped at the first non-participating capture.

CRuby includes non-participating captures with nil values in all cases. This is important for pattern matching where the absence of a key means "does not match" while nil means "matched nothing".

JRuby skipped named capture groups that did not participate
in the match (value is nil).

With nil argument, such keys were omitted entirely.
With explicit keys, iteration stopped at the first non-participating
capture.

CRuby includes non-participating captures with nil values in all
cases. This is important for pattern matching where the absence of
a key means "does not match" while nil means "matched nothing".
@kares kares added this to the JRuby 10.0.5.0 milestone Mar 28, 2026
Copy link
Copy Markdown
Member

@headius headius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving specs to ruby/spec.

@headius headius merged commit 330e2e0 into jruby:jruby-10.0 Mar 28, 2026
107 checks passed
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