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): base class fields not being lifted #6160

Merged
merged 6 commits into from
Apr 7, 2024

Conversation

yoav-steinberg
Copy link
Contributor

@yoav-steinberg yoav-steinberg commented Apr 6, 2024

Fixes #5258
Some details:

  1. Correctly collect fields from entire ancestry when passing lifted fields to class inflight client ctor.
  2. Make sure fields of entire ancestry is taken into account when passing them to super() in the client ctor.
  3. In case a derived field is being used directly in the derived class, we need to de-dup lifted field token names when passing them to the client's ctor (Use IndexMax instead of vec).

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.

Copy link

github-actions bot commented Apr 6, 2024

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

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 Apr 6, 2024

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

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

@monadabot
Copy link
Contributor

monadabot commented Apr 6, 2024

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜🟥⬜⬜⬜⬜⬜
Benchmark Before After Change
version 58ms±0.39 59ms±0.99 +1ms (+1.41%)⬜
functions_1.test.w -t sim 390ms±16.97 385ms±3.73 -5ms (-1.3%)⬜
functions_1.test.w -t tf-aws 821ms±4.54 827ms±7.32 +6ms (+0.73%)⬜
hello_world.test.w -t sim 387ms±8.92 392ms±12.33 +5ms (+1.37%)⬜
hello_world.test.w -t tf-aws 1500ms±8.27 1507ms±8.46 +6ms (+0.41%)⬜
jsii_big.test.w -t sim 2762ms±6.36 2767ms±11.57 +6ms (+0.2%)⬜
jsii_big.test.w -t tf-aws 2979ms±7.5 2983ms±11.9 +4ms (+0.13%)⬜
functions_10.test.w -t sim 458ms±7.86 477ms±4.91 +19ms (+4.19%)🟥
functions_10.test.w -t tf-aws 2105ms±9.92 2121ms±7.89 +16ms (+0.76%)⬜
jsii_small.test.w -t sim 354ms±3.25 361ms±3.72 +7ms (+1.98%)⬜
jsii_small.test.w -t tf-aws 599ms±4.63 598ms±4.93 0ms (-0.05%)⬜
empty.test.w -t sim 349ms±3.86 353ms±3.85 +4ms (+1.11%)⬜
empty.test.w -t tf-aws 585ms±3.82 589ms±3.54 +4ms (+0.73%)⬜

⬜ 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 59ms 57ms 61ms 1ms 1ms
functions_1.test.w -t sim 385ms 381ms 398ms 4ms 5ms
functions_1.test.w -t tf-aws 827ms 812ms 846ms 7ms 10ms
hello_world.test.w -t sim 392ms 373ms 435ms 12ms 17ms
hello_world.test.w -t tf-aws 1507ms 1491ms 1527ms 8ms 12ms
jsii_big.test.w -t sim 2767ms 2733ms 2789ms 12ms 16ms
jsii_big.test.w -t tf-aws 2983ms 2960ms 3010ms 12ms 17ms
functions_10.test.w -t sim 477ms 467ms 488ms 5ms 7ms
functions_10.test.w -t tf-aws 2121ms 2104ms 2139ms 8ms 11ms
jsii_small.test.w -t sim 361ms 351ms 368ms 4ms 5ms
jsii_small.test.w -t tf-aws 598ms 585ms 609ms 5ms 7ms
empty.test.w -t sim 353ms 344ms 360ms 4ms 5ms
empty.test.w -t tf-aws 589ms 580ms 596ms 4ms 5ms
Last Updated (UTC) 2024-04-06 19:11

@yoav-steinberg yoav-steinberg marked this pull request as ready for review April 6, 2024 18:51
@yoav-steinberg yoav-steinberg requested a review from a team as a code owner April 6, 2024 18:51
@yoav-steinberg yoav-steinberg changed the title fix(compiler): lift base class fields even if they're not accessed directly in derrived class fix(compiler): base class fields not being lifted Apr 6, 2024
@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 Apr 6, 2024
@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 Apr 6, 2024
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.

🙏

Copy link
Contributor

mergify bot commented Apr 7, 2024

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

@mergify mergify bot merged commit 20c06f4 into main Apr 7, 2024
17 checks passed
@mergify mergify bot deleted the yoav/init_base_class_fields branch April 7, 2024 08:39
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.67.15.

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.

base class fields are undefined
3 participants