Open
Description
When using pattern matching on a HashWithIndifferentAccess
from ActiveSupport
there appears to be a difference in behavior.
Given the below example, using ActiveSupport
7.2.1
require 'active_support/all'
test = HashWithIndifferentAccess.new('a' => true)
case test
in {a: b}
b
else
false
end
When run on CRuby 3.3.5 it will return true
, while on TruffleRuby 24.2.0-dev-512427a6
it'll return false
This appears to work on CRuby because of three things:
HashWithIndifferentAccess
extendsHash
Hash#deconstruct_keys
returnsself
- The resulting iseq calls
.key?
followed by.[]
on the returned object