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

fix(compiler): can't pass inflight closure as parameter to super() call #6599

Merged
merged 8 commits into from
Jun 2, 2024

Conversation

yoav-steinberg
Copy link
Contributor

fixes #4925

Now you can pass inflight closures and also any new PreflightClass() as parameters to a super() call in a ctor.
What I did is detect these cases and made sure the implicit scope passed to the construct ctor is $scope and not this which isn't available before super() is called.

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • 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.

@yoav-steinberg yoav-steinberg requested a review from a team as a code owner May 30, 2024 12:56
Copy link

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistance, don't hesitate to ping the relevant owner over Discord.

Topic Owner
Wing SDK and utility APIs @chriscbr
Wing Console @ainvoner, @skyrpex, @polamoros
JSON, structs, primitives and collections @hasanaburayyan
Platforms and plugins @hasanaburayyan
Frontend resources (website, react, etc) @tsuf239
Language design @chriscbr
VSCode extension and language server @markmcculloh
Compiler architecture, inflights, lifting @yoav-steinberg
Wing Testing Framework @tsuf239
Wing CLI @markmcculloh
Build system, dev environment, releases @markmcculloh
Library Ecosystem @chriscbr
Documentation @hasanaburayyan
SDK test suite @tsuf239
Examples @hasanaburayyan
Wing Playground @eladcon

@monadabot
Copy link
Contributor

monadabot commented May 30, 2024

Console preview environment is available at https://wing-console-pr-6599.fly.dev 🚀

Last Updated (UTC) 2024-06-02 06:04

@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label May 30, 2024
@monadabot
Copy link
Contributor

Benchmarks

Comparison to Baseline ⬜🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 56ms±0.4 58ms±0.7 +2ms (+2.97%)⬜
functions_10.test.w -t sim 488ms±9.68 508ms±8.23 +20ms (+4.03%)🟥
functions_10.test.w -t tf-aws 2033ms±16.02 2057ms±19.99 +25ms (+1.21%)⬜
hello_world.test.w -t sim 403ms±11.17 403ms±4.71 +0ms (+0.05%)⬜
hello_world.test.w -t tf-aws 1441ms±5.14 1454ms±8.88 +14ms (+0.94%)⬜
functions_1.test.w -t sim 395ms±2.99 399ms±4.42 +3ms (+0.88%)⬜
functions_1.test.w -t tf-aws 817ms±9.9 828ms±12.4 +12ms (+1.41%)⬜
jsii_big.test.w -t sim 2797ms±14.22 2796ms±18.6 -1ms (-0.03%)⬜
jsii_big.test.w -t tf-aws 3012ms±16.19 3006ms±16.96 -6ms (-0.19%)⬜
empty.test.w -t sim 364ms±2 365ms±4.29 +1ms (+0.24%)⬜
empty.test.w -t tf-aws 593ms±3.27 607ms±6.42 +14ms (+2.35%)⬜
jsii_small.test.w -t sim 372ms±3.96 375ms±4.58 +3ms (+0.77%)⬜
jsii_small.test.w -t tf-aws 612ms±4.37 610ms±6.74 -1ms (-0.21%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 58ms 56ms 59ms 1ms 1ms
functions_10.test.w -t sim 508ms 489ms 524ms 8ms 12ms
functions_10.test.w -t tf-aws 2057ms 2022ms 2121ms 20ms 28ms
hello_world.test.w -t sim 403ms 396ms 418ms 5ms 7ms
hello_world.test.w -t tf-aws 1454ms 1436ms 1477ms 9ms 12ms
functions_1.test.w -t sim 399ms 392ms 412ms 4ms 6ms
functions_1.test.w -t tf-aws 828ms 810ms 872ms 12ms 17ms
jsii_big.test.w -t sim 2796ms 2766ms 2851ms 19ms 26ms
jsii_big.test.w -t tf-aws 3006ms 2971ms 3044ms 17ms 24ms
empty.test.w -t sim 365ms 357ms 374ms 4ms 6ms
empty.test.w -t tf-aws 607ms 593ms 620ms 6ms 9ms
jsii_small.test.w -t sim 375ms 360ms 381ms 5ms 6ms
jsii_small.test.w -t tf-aws 610ms 591ms 623ms 7ms 9ms
Last Updated (UTC) 2024-05-30 18:51

Copy link
Contributor

@Chriscbr Chriscbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! 🙌

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

@yoav-steinberg yoav-steinberg removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Jun 2, 2024
Copy link
Contributor

mergify bot commented Jun 2, 2024

Thanks for contributing, @yoav-steinberg! This PR will now be added to the merge queue, or immediately merged if yoav/pass_inflight_closure_as_super_param is up-to-date with main and the queue is empty.

mergify bot added a commit that referenced this pull request Jun 2, 2024
@mergify mergify bot merged commit ccdd51b into main Jun 2, 2024
15 checks passed
@mergify mergify bot deleted the yoav/pass_inflight_closure_as_super_param branch June 2, 2024 06:11
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.74.30.

eladb pushed a commit that referenced this pull request Jun 6, 2024
…call (#6599)

fixes #4925

Now you can pass inflight closures and also any `new PreflightClass()` as parameters to a `super()` call in a ctor.
What I did is detect these cases and made sure the implicit scope passed to the construct ctor is `$scope` and not `this` which isn't available before `super()` is called.


## 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)*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't pass an inflight closure to a super ctor call
4 participants