Skip to content

public_method_defined? changed value after prepend unrelated module #7545

@godfat

Description

@godfat

Environment Information

Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)

    jruby 9.4.0.0 (3.1.0) 2022-11-23 95c0ec159f OpenJDK 64-Bit Server VM 19.0.1+10 on 19.0.1+10 +jit [x86_64-linux]
    
  • Operating system and platform (e.g. uname -a)

    Linux li1544-77 5.13.4-x86_64-linode146 #1 SMP Wed Jul 21 14:45:45 EDT 2021 x86_64 GNU/Linux
    

Expected Behavior

Prints true and true with this line:

jruby -ve 'class T; def f; end; end; p T.public_method_defined?(:f, false); T.prepend Module.new; p T.public_method_defined?(:f, false)'

Or indented code:

class T
  def f
  end
end

p T.public_method_defined?(:f, false)

T.prepend Module.new

p T.public_method_defined?(:f, false)

Output:

true
true

Actual Behavior

Output:

true
false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions