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

feat(compiler)!: explicit lift qualification statement #6400

Merged
merged 41 commits into from May 19, 2024

Conversation

yoav-steinberg
Copy link
Collaborator

@yoav-steinberg yoav-steinberg commented May 2, 2024

fixes #6080

Initial implementation of the explicit lift statement as defined in the rfc.

let bucket = new cloud.Bucket();
inflight () => {
  let b = bucket; // Assing preflight object to inflight variable
  lift {bucket: put} {
    b.put("k","v"); // Within this block we can use the inflight variable because of the explicit lifting above
  }
  b.put("k","v"); // This is an error, because it's outside the explicit lift block and we can't figure out who `b` is
  
  // We can also define multiple lifts in a block and multiple ops per lift
  lift {bucket1: [put, get], bucket2: delete} { ... }
  
  // We can nest lift blocks
  lift {bucket1: put} {
    ..
    lift {bucket2: get} {
      ..
    }
  }

  // Type checker validates passed methods are really part of the inflight interface of the object
  lift {bucket: leak} {}
              //^ err: leak isn't an inflight method on type Bucket
}

Breaking change: this is instead of the lift() builtin macro that was used for the same purpose.

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 2, 2024 18:13
Copy link

github-actions bot commented May 2, 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 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

@yoav-steinberg yoav-steinberg changed the title feat!(compiler): new explicit lift qualification statement feat!(compiler)!: explicit lift qualification statement May 2, 2024
@yoav-steinberg yoav-steinberg changed the title feat!(compiler)!: explicit lift qualification statement feat(compiler)!: explicit lift qualification statement May 2, 2024
@monadabot
Copy link
Contributor

monadabot commented May 2, 2024

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

Last Updated (UTC) 2024-05-19 09:18

@monadabot
Copy link
Contributor

monadabot commented May 2, 2024

Benchmarks

Comparison to Baseline 🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 57ms±0.52 59ms±0.59 +2ms (+3.43%)🟥
functions_10.test.w -t sim 498ms±11.48 511ms±14.04 +13ms (+2.52%)⬜
functions_10.test.w -t tf-aws 2074ms±14.05 2112ms±22.77 +38ms (+1.83%)⬜
hello_world.test.w -t sim 407ms±5.54 418ms±8.98 +11ms (+2.76%)⬜
hello_world.test.w -t tf-aws 1456ms±7.36 1472ms±4.84 +16ms (+1.1%)⬜
functions_1.test.w -t sim 410ms±4.56 399ms±5.19 -10ms (-2.56%)⬜
functions_1.test.w -t tf-aws 846ms±6.9 831ms±7.33 -15ms (-1.8%)⬜
jsii_big.test.w -t sim 2840ms±8.24 2826ms±16.58 -14ms (-0.48%)⬜
jsii_big.test.w -t tf-aws 3072ms±14.47 3054ms±9.21 -18ms (-0.58%)⬜
empty.test.w -t sim 370ms±3.94 374ms±5.45 +4ms (+1.14%)⬜
empty.test.w -t tf-aws 604ms±3.9 607ms±3.49 +4ms (+0.64%)⬜
jsii_small.test.w -t sim 380ms±4.59 383ms±3.59 +3ms (+0.81%)⬜
jsii_small.test.w -t tf-aws 622ms±5.13 625ms±5.68 +4ms (+0.62%)⬜

⬜ 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 58ms 61ms 1ms 1ms
functions_10.test.w -t sim 511ms 484ms 542ms 14ms 20ms
functions_10.test.w -t tf-aws 2112ms 2051ms 2149ms 23ms 32ms
hello_world.test.w -t sim 418ms 404ms 451ms 9ms 13ms
hello_world.test.w -t tf-aws 1472ms 1460ms 1480ms 5ms 7ms
functions_1.test.w -t sim 399ms 393ms 412ms 5ms 7ms
functions_1.test.w -t tf-aws 831ms 813ms 841ms 7ms 10ms
jsii_big.test.w -t sim 2826ms 2788ms 2864ms 17ms 23ms
jsii_big.test.w -t tf-aws 3054ms 3040ms 3078ms 9ms 13ms
empty.test.w -t sim 374ms 358ms 383ms 5ms 8ms
empty.test.w -t tf-aws 607ms 598ms 613ms 3ms 5ms
jsii_small.test.w -t sim 383ms 374ms 389ms 4ms 5ms
jsii_small.test.w -t tf-aws 625ms 608ms 635ms 6ms 8ms
Last Updated (UTC) 2024-05-19 09:24

monadabot and others added 4 commits May 2, 2024 15:04
Signed-off-by: monada-bot[bot] <monabot@monada.co>
Signed-off-by: monada-bot[bot] <monabot@monada.co>
Signed-off-by: monada-bot[bot] <monabot@monada.co>
@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 2, 2024
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 work @yoav-steinberg! Added a few suggestions but otherwise looks good to me.

docs/docs/02-concepts/01-preflight-and-inflight.md Outdated Show resolved Hide resolved
docs/docs/02-concepts/01-preflight-and-inflight.md Outdated Show resolved Hide resolved
libs/wingc/src/lifting.rs Show resolved Hide resolved
libs/wingc/src/type_check.rs Show resolved Hide resolved
tools/hangar/__snapshots__/invalid.ts.snap Outdated Show resolved Hide resolved
tools/hangar/__snapshots__/invalid.ts.snap Outdated Show resolved Hide resolved
libs/wingc/src/type_check.rs Outdated Show resolved Hide resolved
libs/wingc/src/parser.rs Outdated Show resolved Hide resolved
yoav-steinberg and others added 13 commits May 19, 2024 09:39
Co-authored-by: Chris Rybicki <chrisr@monada.co>
Co-authored-by: Chris Rybicki <chrisr@monada.co>
Co-authored-by: Chris Rybicki <chrisr@monada.co>
Co-authored-by: Chris Rybicki <chrisr@monada.co>
Co-authored-by: Chris Rybicki <chrisr@monada.co>
Signed-off-by: monada-bot[bot] <monabot@monada.co>
Signed-off-by: monada-bot[bot] <monabot@monada.co>
@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 May 19, 2024
Copy link
Contributor

mergify bot commented May 19, 2024

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

@mergify mergify bot merged commit d9a9ddf into main May 19, 2024
15 checks passed
@mergify mergify bot deleted the yoav/explicit_lift_qual_v2 branch May 19, 2024 09:36
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.74.0.

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.

The syntax around lift() statements is confusing
4 participants