-
Notifications
You must be signed in to change notification settings - Fork 201
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
fix(compiler): closure transform generated parent_this
even when not used
#6531
Conversation
Thanks for opening this pull request! 🎉
|
Console preview environment is available at https://wing-console-pr-6531.fly.dev 🚀 Last Updated (UTC) 2024-05-22 10:43 |
BenchmarksComparison to Baseline 🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜ Within 1.5 standard deviations Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI. Results
Last Updated (UTC) 2024-05-22 10:38 |
Signed-off-by: monada-bot[bot] <monabot@monada.co>
Thanks for contributing, @yoav-steinberg! This PR will now be added to the merge queue, or immediately merged if |
Congrats! 🚀 This was released in Wing 0.74.7. |
…6535) This is part of the effort to address #4925. Because inflight closures turn into class definitions, when they are passed to a `super()` call we use to get an error telling us that `super()` must be the first statement in a ctor. Now this is fixed: ```wing class Foo { new(x: num) {} } class Bar extends Foo { new() { class Baz {} // This is now ok super(1); } } ``` This PR also improves the diagnostics for mssing super calls or "not first statement" super calls. note: waiting for #6531 to be merged first. ## Checklist - [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 [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
This is a small code cleanup as part of addressing #4925.
We only generate the
parent_this
variable used in generated closure classes when needed. If the inflight closure never accessesthis
then we don't generatedparent_this
. The code avoids traversing into inner classes inside the closure when searching forthis
accesses, making it a bit cleaner and more efficient.This relates to #4925 because it solves the problem of accessing
this
(for assignment intoparent_this
) before thesuper()
call in a ctor.Checklist
pr/e2e-full
label if this feature requires end-to-end testingBy submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.