-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
The following code triggers an unnecessary strong type-check in RBTree#merge!
.../gems/2.2.0/gems/rbtree-pure-0.1.1/lib/rbtree/rb_tree.rb:409:in `merge!': wrong argument type Index (expected RBTree) (TypeError)
The type-check is only needed if the block is given (the other path works with a Hash),
and even that path should use kind_of?, not instance_of?
Even better would be to detect that kind_of?(RBTree) is false and use a generic code path.
require "rbtree"
class Index < RBTree
end
i = Index.new
i[:a] = 1
j = Index.new
j[:b] = 2
j.merge!(i)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels