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
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions examples/tests/invalid/bring_non_std_construct.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
bring "cdktf" as cdktf;

// We want to test importing a construct that doesn't have a `scope`/`id` pair as its first arguments.
// Such constructs are technically valid but go against CDK conventions. Nonetheless we need to see
// we support them and provide correct diagnosticts when the user uses them.
// We use cdktf's backends as an example of such constructs.

new cdktf.S3Backend();
//^ Expected 1 positional argument(s) but got 0

class Foo {
init() {
new cdktf.S3Backend(this, cdktf.S3BackendConfig {bucket: "foo", key: "bar"}) as "s3_backend";
//^ Cannot set id of non-standard preflight class "S3Backend" using `as`
new cdktf.S3Backend(this, cdktf.S3BackendConfig {bucket: "foo", key: "bar"}) in this;
//^ Cannot set scope of non-standard preflight class "S3Backend" using `in`
}
}
Loading