Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `include' for A:Class #2408

Closed
endofunky opened this issue Jan 2, 2015 · 1 comment
Closed

NoMethodError: undefined method `include' for A:Class #2408

endofunky opened this issue Jan 2, 2015 · 1 comment

Comments

@endofunky
Copy link

Nested includes with a Module.included in between spread over multiple files throws a NoMethodError. This is on the latest 9.0.0.0 SNAPSHOT installed with ruby-build.

Example:

File a.rb:

require_relative 'b'

class A
  include B
end

File b.rb:

module C
end

module B
  def self.included(klass)
    klass.include C
  end
end

Output:

$ ruby ./a.rb
NoMethodError: undefined method `include' for A:Class
  method_missing at org/jruby/RubyBasicObject.java:1600
        included at /home/toby/jruby-bug/b.rb:6
         include at org/jruby/RubyModule.java:2220
           A_0_1 at ./a.rb:7
      __script__ at ./a.rb:6

However, if the modules in file b.rb are defined in the same file a.rb everything works fine. Both ways work in MRI.

@enebo enebo added this to the JRuby 9.0.0.0-pre1 milestone Jan 4, 2015
@headius
Copy link
Member

headius commented Jan 6, 2015

I think this is a simple visibility problem: ruby/ruby@26766ee

@headius headius closed this as completed in c9d8c77 Jan 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants