Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@afurm
Copy link
Member

@afurm afurm commented Dec 27, 2025

This PR fixes Bug #21805 where destructuring a Data object (or Struct/MatchData) with a pattern containing missing keys would report an existing key as missing.

@afurm afurm changed the title **Fix misleading NoMatchingPatternKeyError when destructuring Data, Struct, and MatchData** Fix misleading NoMatchingPatternKeyError when destructuring Data, Struct, and MatchData Dec 27, 2025
@afurm afurm force-pushed the fix/bug-21805-deconstruct-keys-error branch from 4db3068 to a892f1c Compare December 27, 2025 11:12
Fixes Bug #21805. Improved deconstruct_keys behavior to return all
found keys instead of failing early or returning an empty hash when
more keys are requested than the object contains.

Modified files:
- struct.c: Fix rb_struct_deconstruct_keys
- re.c: Fix match_deconstruct_keys
- test/ruby/test_data.rb: Update tests
- test/ruby/test_regexp.rb: Update tests
- spec/ruby/core/data/deconstruct_keys_spec.rb: Update specs
- spec/ruby/core/struct/deconstruct_keys_spec.rb: Update specs
- spec/ruby/core/matchdata/deconstruct_keys_spec.rb: Update specs
@afurm afurm force-pushed the fix/bug-21805-deconstruct-keys-error branch from a892f1c to 09cb6da Compare December 27, 2025 11:12
@nobu nobu requested a review from soutaro December 31, 2025 02:10
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