-
Notifications
You must be signed in to change notification settings - Fork 122
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
Handle class attributes used inside concerns #515
Conversation
d7a0807
to
5607d23
Compare
5607d23
to
d347755
Compare
I have bumped the Sorbet requirement, applied the requested changes and made three fixes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, I have a couple of minor comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect. Thank you!
Fixes #250, more generally |
@paracycle I think that in order to fix #250 we could use the same strategy, but we'd need to also patch |
I know but that is one usage that I would not want us to support since it is a bad usage of the language. The user should feel the friction in that case and fix their code. On the other hand, for things like |
Motivation
Sorbet is not able to identify class attributes created inside
included
blocks in concerns, which leads to false positives for method missing.E.g.:
Tapioca can find these attributes when we find dynamic inclusion and extension and output the complete RBIs.
Implementation
DynamicMixinCompiler
and modified it to keep track of class attributesGeneratedClassMethods
andGeneratedInstanceMethods
Next steps
This PR will handle gems that create class attribute inside concerns, but applications can also do the same. We can leverage the same logic in a DSL generator to handle that case as well and produce the correct RBIs for concerns.
Tests
See included tests.