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): panic when trying to import JSII constructs with no scope/id args #3057

Merged
merged 10 commits into from
Jun 27, 2023

Conversation

yoav-steinberg
Copy link
Contributor

@yoav-steinberg yoav-steinberg commented Jun 25, 2023

See #2934
Importing a construct from JSII that doesn't have a scope/id arg pair as the first constructor arguments panicked the compiler. We now detect such (unconventional) constructs and mark them as so. This makes them non compatible with our as/in keywords for explicit scope/id control, but they can still be used by passing the correct (non standard) arguments to them.
This resolves importing the cdktf library because its Backend constructs are an example of such non-standard constructs.

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 Monada Contribution License.

@yoav-steinberg yoav-steinberg requested a review from a team as a code owner June 25, 2023 20:48
@yoav-steinberg yoav-steinberg changed the title fix(compiler): panic when trying to import JSII Constructs with node scoe/id args fix(compiler): panic when trying to import JSII constructs with nod scoe/id args Jun 25, 2023
@staycoolcall911 staycoolcall911 changed the title fix(compiler): panic when trying to import JSII constructs with nod scoe/id args fix(compiler): panic when trying to import JSII constructs with no scope/id args Jun 26, 2023
Copy link
Contributor

@staycoolcall911 staycoolcall911 left a comment

Choose a reason for hiding this comment

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

Nice!

libs/wingc/src/type_check.rs Outdated Show resolved Hide resolved
libs/wingc/src/type_check.rs Outdated Show resolved Hide resolved
libs/wingc/src/type_check.rs Outdated Show resolved Hide resolved
examples/tests/valid/bring_cdktf.w Show resolved Hide resolved
libs/wingc/src/type_check/jsii_importer.rs Show resolved Hide resolved
libs/wingc/src/type_check/jsii_importer.rs Outdated Show resolved Hide resolved
@Chriscbr
Copy link
Contributor

@yoav-steinberg I think this might also resolve #1485, not totally sure

@yoav-steinberg yoav-steinberg linked an issue Jun 27, 2023 that may be closed by this pull request
@mergify
Copy link
Contributor

mergify bot commented Jun 27, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit f3890b1 into main Jun 27, 2023
11 checks passed
@mergify mergify bot deleted the yoav/import_cdktf branch June 27, 2023 05:01
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.22.23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants