We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
headius
Learn more about funding links in repositories.
Report abuse
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
Likely the same root cause as #4228
A singleton method that is cloned and then redefined is overwritten, not overridden.
MRI
class Foo def bar puts 'class method' end end object = Foo.new object.define_singleton_method(:bar) do puts 'instance method 1' super() end cloned = object.clone cloned.define_singleton_method(:bar) do puts 'instance method 2' super() end cloned.bar #=> instance method 2 #=> class method
class Foo def bar puts 'class method' end end object = Foo.new object.define_singleton_method(:bar) do puts 'instance method 1' super() end cloned = object.clone cloned.define_singleton_method(:bar) do puts 'instance method 2' super() end cloned.bar #=> instance method 2 #=> instance method 1 #=> class method
The text was updated successfully, but these errors were encountered:
Looks like we're not properly cloning the singleton class...probably using the old one as superclass for the new clone.
Sorry, something went wrong.
Fix clone metaclass setup based on current MRI. Fixes jruby#4229.
8e3e425
Add spec for replacing singleton method in a cloned singleton.
d9b0e23
See jruby#4229.
I created #4233 to test my changes. Your test case passes and I turned it into a spec for ruby/spec. We'll see how it looks in CI.
e6ccd18
afe5e51
9755210
See jruby/jruby#4229.
No branches or pull requests
Likely the same root cause as #4228
Environment
Expected Behavior
A singleton method that is cloned and then redefined is overwritten, not overridden.
MRI
Actual Behavior
The text was updated successfully, but these errors were encountered: