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
Set#dup does not seem to call #initialize_copy #6903
Milestone
Comments
Aha, just a missing bit from our native port I guess. Quick fix. |
FWIW we do intend for our native Set to work exactly like the CRuby version, so this should get some specs to cover subclass usage. |
Also affects 9.2.19 so I will retarget. |
headius
added a commit
to headius/jruby
that referenced
this issue
Oct 26, 2021
headius
added a commit
to headius/jruby
that referenced
this issue
Oct 26, 2021
Fixed by #6910. |
This will be in 9.2.20 and 9.3.2. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I ran into this edge-case when working with classes which inherit from
Set
(I know, I probably shouldn't do that) and the classes contain other instance variables which require custominitialize_copy
logic to copy them over when the set is duplicated, such as whenSet#|
is called; the implementation ofSet#|
on both CRuby and JRuby is essentiallydup.merge(other)
.Under JRuby (9.3.1.0), the custom
initialize_copy
method does not seem to be called whenSet#dup
is called.Steps To Reproduce
CRuby 2.7.4
CRuby 3.0.2
JRuby 9.3.1.0
The text was updated successfully, but these errors were encountered: