-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Re-unify module and interface in ConcreteModuleType #29825
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
Conversation
We made `ModuleInfo` a union initially to represent the idea that a submodule could either be a regular module or a module interface. This PR represents module interfaces as a ConcreteModuleType with no info (e.g. no "sugaredness"), and with the interface type as the underlying `jitType_`. This has the effect of reducing the special casing around adding/maintaining module info.
|
cc @wanchaol |
CircleCI build failures summaryAs of commit 496e993:
Here are the reasons each build failed:
This comment was automatically generated by Dr. CI. Please report bugs/suggestions on the GitHub issue tracker. |
wanchaol
left a comment
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 nice! one minor comment.
We made `ModuleInfo` a union initially to represent the idea that a submodule could either be a regular module or a module interface. This PR represents module interfaces as a ConcreteModuleType with no info (e.g. no "sugaredness"), and with the interface type as the underlying `jitType_`. This has the effect of reducing the special casing around adding/maintaining module info.
| const auto& selfType = concreteType_->getJitType(); | ||
| const auto& selfType_ = concreteType_->getJitType(); | ||
| if (selfType_->cast<InterfaceType>()) { | ||
| return std::make_shared<SimpleValue>(self_)->attr(loc, m, field); |
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.
SimpleValue(self)-> since we are deleting the object directly after.
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.
Changing it would cause a lint error internally: https://fburl.com/wiki/jshlq9g3. Which doesn't apply in this situation but I guess could conceivably happen with some more code mutations down the road, so we might as well follow the rule?
| return std::make_shared<SimpleValue>(self_)->attr(loc, m, field); | ||
| // ...otherwise, methods, parameters, attributes, and buffers are all | ||
| // first class so they get returned as SimpleValues | ||
| return std::make_shared<SimpleValue>(self_)->attr(loc, m, field); |
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.
same here
We made `ModuleInfo` a union initially to represent the idea that a submodule could either be a regular module or a module interface. This PR represents module interfaces as a ConcreteModuleType with no info (e.g. no "sugaredness"), and with the interface type as the underlying `jitType_`. This has the effect of reducing the special casing around adding/maintaining module info. Differential Revision: [D18575011](https://our.internmc.facebook.com/intern/diff/D18575011)
We made `ModuleInfo` a union initially to represent the idea that a submodule could either be a regular module or a module interface. This PR represents module interfaces as a ConcreteModuleType with no info (e.g. no "sugaredness"), and with the interface type as the underlying `jitType_`. This has the effect of reducing the special casing around adding/maintaining module info. Differential Revision: [D18575011](https://our.internmc.facebook.com/intern/diff/D18575011)
Stack from ghstack:
We made
ModuleInfoa union initially to represent the idea that asubmodule could either be a regular module or a module interface.
This PR represents module interfaces as a ConcreteModuleType with no
info (e.g. no "sugaredness"), and with the interface type as the
underlying
jitType_. This has the effect of reducing the specialcasing around adding/maintaining module info.
Differential Revision: D18575011