Issue #15917 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Bug #15917: Pattern matching for Struct
https://bugs.ruby-lang.org/issues/15917

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`Struct`s respond to `deconstruct`, not to `deconstruct_keys`. Shouldn't we also implement it?

```
A = Struct.new(:foo, :bar)

case A.new(1, 2)
in foo: 1, **rest
  p "match"
else
  p "no match"
end
# => "no match", should be "match"
```




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>