Actions
Bug #22708
openUnboundMethod#inspect for ZSUPER method potentially shows undefined method since Ruby 3.2
Bug #22708:
UnboundMethod#inspect for ZSUPER method potentially shows undefined method since Ruby 3.2
Description
Starting in Ruby 3.2, UnboundMethod#inspect drops the class defining the ZSUPER method. Method#inspect always shows the class:
class C
def c; 1 end
end
class SC < C
alias sc c
end
p SC.instance_method(:sc)
# Ruby 2.2-2.6: #<UnboundMethod: SC(C)#sc(c)>
# Ruby 2.7-3.1: #<UnboundMethod: SC(C)#sc(c)() -:2>
# Ruby 3.2-4.0: #<UnboundMethod: C#sc(c)() -:2>
p SC.new.method(:sc)
# Ruby 2.2-2.6: #<Method: SC(C)#sc(c)>
# Ruby 2.7-4.0: #<Method: SC(C)#sc(c)() -:2>
The C#sc(c) for Ruby 3.2-4.0 seems wrong to me, because C#sc is not defined (SC#sc is defined). I think we should restore the Ruby 2.7-3.1 behavior for UnboundMethod#inspect, making it consistent with Method#inspect.
Actions