Skip to content

Refinements are not activated in send #5945

@palkan

Description

@palkan

Hey! It's me again 🙂

Environment

Provide at least:

  • JRuby version: jruby 9.2.8.0 (2.5.3) 2019-08-12 a1ac7ff OpenJDK 64-Bit Server VM 25.222-b10 on 1.8.0_222-b10 +jit [linux-x86_64]
  • Operating system and platform: Linux 562bfe67be53 4.9.125-linuxkit break script engine #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 GNU/Linux

Expected Behavior

The code below prints "foo".

class A
end

module Ext
  refine A do
    def foo
      "foo"
    end
  end
end

using Ext

p A.new.send(:foo)

Actual Behavior

NoMethodError: undefined method `foo' for #<A:0x305fd85d>
Did you mean?  fork
  <main> at test.rb:14

Note

Refinements have been working with send in MRI since 2.5. In 2.6, the support for public_send and respond_to? has been added (already mentioned in #5576).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions