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

Included methods don't appear to exist in the TypeNode #8164

Open
watzon opened this issue Sep 8, 2019 · 4 comments
Open

Included methods don't appear to exist in the TypeNode #8164

watzon opened this issue Sep 8, 2019 · 4 comments

Comments

@watzon
Copy link
Contributor

watzon commented Sep 8, 2019

It looks as though for some reason methods that are defined in a module and then included into a class are not added to that class in macro world. Here is an example of this behavior in action:

annotation Ann; end

module Foo
  @[Ann]
  def meth
    puts 'f'
  end
end

abstract class Parent; end

class MyClass < Parent
  include Foo
end

macro finished
  pp \{{Parent.subclasses.first.methods.first}} # => nil
end

Thank you @Blacksmoke16

@asterite
Copy link
Member

asterite commented Sep 8, 2019

They are never added to the class. They are in the module.

@Blacksmoke16
Copy link
Member

I guess then the issue is that there isn't a way to get the modules included in a type. So currently that method is lost in the void.

@asterite
Copy link
Member

asterite commented Sep 8, 2019

Another answer: I don't think the methods macro method includes methods from ancestors.

@HertzDevil
Copy link
Contributor

Related: #8586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants