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 inherit an stdlib resource #4640

Merged
merged 17 commits into from
Oct 23, 2023
Merged

Conversation

yoav-steinberg
Copy link
Contributor

@yoav-steinberg yoav-steinberg commented Oct 23, 2023

Fixes #3585

Before this PR our dependency injection only worked on new calls. So when instantiating an stdlib cloud.Api for example you'd get a cloud.Api instance matching the desired target. But when inheriting from an stdlib preflight class dependency injection wasn't being done. So we just inherited the abstract base class.
With this change we get dependency injection also when doing extends cloud.SomeThing. The way I got this to work is by changing the dep-injection mechanism to return not a concrete instance but rather a concrete type. Then we can instantiate that type or inherit it based on what we need.

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 October 23, 2023 11:00
@monadabot
Copy link
Contributor

monadabot commented Oct 23, 2023

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

Last Updated (UTC) 2023-10-23 16:08

@MarkMcCulloh
Copy link
Contributor

Does this fix #3585? (#4205 is a dupe)
Needs a test

@monadabot
Copy link
Contributor

monadabot commented Oct 23, 2023

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 85ms±2.4 86ms±2.28 +1ms (+0.99%)⬜
functions_1.test.w -t sim 692ms±9.58 694ms±9.85 +2ms (+0.28%)⬜
functions_1.test.w -t tf-aws 2311ms±48.74 2368ms±71.89 +57ms (+2.45%)⬜
jsii_small.test.w -t sim 645ms±6.64 639ms±6.17 -6ms (-0.88%)⬜
jsii_small.test.w -t tf-aws 817ms±19.91 802ms±6.67 -15ms (-1.86%)⬜
functions_10.test.w -t sim 768ms±14.28 751ms±3.05 -17ms (-2.16%)⬜
functions_10.test.w -t tf-aws 4427ms±30.08 4442ms±41.73 +16ms (+0.35%)⬜
hello_world.test.w -t sim 686ms±8.96 694ms±5.32 +8ms (+1.18%)⬜
hello_world.test.w -t tf-aws 5503ms±28.52 5542ms±40.59 +39ms (+0.7%)⬜
empty.test.w -t sim 634ms±10.3 638ms±6.46 +4ms (+0.61%)⬜
empty.test.w -t tf-aws 797ms±8.2 797ms±7.32 +0ms (+0.04%)⬜
jsii_big.test.w -t sim 4044ms±32.07 4075ms±36.87 +31ms (+0.78%)⬜
jsii_big.test.w -t tf-aws 4248ms±78.11 4236ms±31.85 -12ms (-0.29%)⬜

⬜ 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 86ms 83ms 92ms 2ms 3ms
functions_1.test.w -t sim 694ms 675ms 725ms 10ms 14ms
functions_1.test.w -t tf-aws 2368ms 2210ms 2523ms 72ms 101ms
jsii_small.test.w -t sim 639ms 625ms 656ms 6ms 9ms
jsii_small.test.w -t tf-aws 802ms 791ms 825ms 7ms 9ms
functions_10.test.w -t sim 751ms 747ms 761ms 3ms 4ms
functions_10.test.w -t tf-aws 4442ms 4366ms 4539ms 42ms 58ms
hello_world.test.w -t sim 694ms 680ms 707ms 5ms 7ms
hello_world.test.w -t tf-aws 5542ms 5478ms 5626ms 41ms 57ms
empty.test.w -t sim 638ms 620ms 653ms 6ms 9ms
empty.test.w -t tf-aws 797ms 776ms 810ms 7ms 10ms
jsii_big.test.w -t sim 4075ms 4033ms 4213ms 37ms 52ms
jsii_big.test.w -t tf-aws 4236ms 4154ms 4291ms 32ms 45ms
Last Updated (UTC) 2023-10-23 16:18

@yoav-steinberg
Copy link
Contributor Author

Does this fix #3585? (#4205 is a dupe)

It does

Needs a test

done

libs/wingc/src/jsify.rs Outdated Show resolved Hide resolved
libs/wingsdk/src/core/app.ts Show resolved Hide resolved
@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 Oct 23, 2023
@MarkMcCulloh MarkMcCulloh removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Oct 23, 2023
@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 Oct 23, 2023
@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 Oct 23, 2023
@mergify
Copy link
Contributor

mergify bot commented Oct 23, 2023

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

@mergify mergify bot merged commit add9ab6 into main Oct 23, 2023
15 checks passed
@mergify mergify bot deleted the yoav/inherit_stdlib branch October 23, 2023 16:23
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.41.11.

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.

(intermediate value).get is not a function when trying to override an extended cloud.Api function
5 participants