Skip to content
  • Koichi Sasada's avatar
    59e389af
    UnboundMethod only refer defined_class · 59e389af
    Koichi Sasada authored
    UnboundMethod records caller's class, like `D` or `E` on the
    following case:
    
    ```ruby
    class C
      def foo = :foo
    end
    
    class D < C
    end
    
    class E < C
    end
    
    d = D.instance_method(:foo)
    e = E.instance_method(:foo)
    ```
    
    But `d` and `e` only refers `C#foo` so that UnboundMethod doesn't
    record `D` or `E`. This behavior changes the following methods:
    
    * `UnboundMethod#inspect` (doesn't show caller's class)
    * `UnboundMethod#==` (`d == e` for example)
    
    fix https://bugs.ruby-lang.org/issues/18798
    59e389af
    UnboundMethod only refer defined_class
    Koichi Sasada authored
    UnboundMethod records caller's class, like `D` or `E` on the
    following case:
    
    ```ruby
    class C
      def foo = :foo
    end
    
    class D < C
    end
    
    class E < C
    end
    
    d = D.instance_method(:foo)
    e = E.instance_method(:foo)
    ```
    
    But `d` and `e` only refers `C#foo` so that UnboundMethod doesn't
    record `D` or `E`. This behavior changes the following methods:
    
    * `UnboundMethod#inspect` (doesn't show caller's class)
    * `UnboundMethod#==` (`d == e` for example)
    
    fix https://bugs.ruby-lang.org/issues/18798
Loading