Skip to content

method_receiver returns inconsistent receiver for self.method #657

@alexcrocha

Description

@alexcrocha

self.bar inside class Foo and Foo.bar both call a method on the Foo class object, but method_receiver returns different receivers:

  class Foo
    self.bar  # receiver: Foo
  end

  Foo.bar     # receiver: <Foo>

I would expect these to be equivalent, as both target a method on the singleton class of Foo.

Found while pairing on #645 and investigating the behaviour of method_receiver.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions