-
Notifications
You must be signed in to change notification settings - Fork 196
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
Support calling super methods #2986
Comments
@staycoolcall911 this needs to be p1. We can't really extend anything without this. |
@eladb I think it might fall into p1 territory as well. Right now you can still access methods on the class A {
init() {}
toString(): str {
return "parent";
}
}
class B extends A {
init() { super() }
toStringNotOverriden() {
return this.toString() + " child";
}
} |
Changed to p1 |
see #2986 This adds the ability to call the superclass's overridden methods from an extended class ```wing class A { do() {} } class B extends A { do() { super.do(); // call A's "do" } } ``` Note that this currently doesn't support calling a super method from within an inflight closure (the complexity of capturing the parent's `super` after the closure is transformed into a class was too much.. see #3474). - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://www.winglang.io/terms-and-policies/contribution-license.html)*.
Congrats! 🚀 This was released in Wing 0.24.41. |
Feature Spec
Wing now supports calling methods from inherited classes within derived classes with
super.
Use Cases
Allows calling of inherited methods
Implementation Notes
No response
Component
No response
Community Notes
The text was updated successfully, but these errors were encountered: