-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
When defining new on a class singleton that gets aliased to another name, super inside the class dispatches to the aliased, not the original name. MRI and RBX both behave different here and dispatch to superclasses original named method.
crash.rb
class Foo
def self.new
super
end
class << self
alias_method :bar, :new
end
end
p Foo.barjruby:
jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on OpenJDK 64-Bit Server VM 1.7.0_40-b31 +indy [linux-am
mbj@mbj ~/devel/crash (master*) % jruby crash.rb
NoMethodError: super: no superclass method `bar'
new at crash.rb:4
(root) at crash.rb:13
cruby:
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
mbj@mbj ~/devel/crash (master*) % ruby crash.rb
#<Foo:0x007f0f1d4fc580>
I reduced this bug from around 20kloc, and hope you can fix it in the next minor release. I can trigger this very easily from my production code. Using 1.7.2 now where this bug does not exist.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels