Project

General

Profile

Actions

Bug #21805

open

Wrong "key not found" in NoMatchingPatternKeyError when destructuring Data

Bug #21805: Wrong "key not found" in NoMatchingPatternKeyError when destructuring Data

Added by esad (Esad Hajdarevic) about 5 hours ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [arm64-darwin24]
[ruby-core:124361]

Description

Consider

Foo = Data.define(:x)
Foo.new(1) => {x:, z:}

It raises #<data Foo x=1>: key not found: :x (NoMatchingPatternKeyError)

Clearly the message is misleading, as it is key :z that is missing.

No data to display

Actions

Also available in: PDF Atom