Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

me #5

Open
cjheath opened this issue Jul 1, 2016 · 0 comments
Open

me #5

cjheath opened this issue Jul 1, 2016 · 0 comments

Comments

@cjheath
Copy link

cjheath commented Jul 1, 2016

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)

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

No branches or pull requests

1 participant