diff --git a/packages/jsii-calc/lib/submodule/child/index.ts b/packages/jsii-calc/lib/submodule/child/index.ts index b6e91d2afd..c7392cab84 100644 --- a/packages/jsii-calc/lib/submodule/child/index.ts +++ b/packages/jsii-calc/lib/submodule/child/index.ts @@ -31,8 +31,13 @@ export class OuterClass { export enum SomeEnum { SOME = 'SOME', } + +export interface AnotherStruct { + readonly stringProperty: string; +} export interface SomeStruct { readonly prop: SomeEnum; + readonly nestedStruct?: AnotherStruct; } export class InnerClass { public static readonly staticProp: SomeStruct = { prop: SomeEnum.SOME }; diff --git a/packages/jsii-rosetta/test/translations/imports/submodule-import.cs b/packages/jsii-rosetta/test/translations/imports/submodule-import.cs index b83d38c184..1c84fdf1fe 100644 --- a/packages/jsii-rosetta/test/translations/imports/submodule-import.cs +++ b/packages/jsii-rosetta/test/translations/imports/submodule-import.cs @@ -9,7 +9,7 @@ }); // Accesses two distinct points of the submodule hierarchy -var myClass = new Submodule.MyClass(new SomeStruct { Prop = Submodule.Child.SomeEnum.SOME }); +var myClass = new Submodule.MyClass(new SomeStruct { Prop = Submodule.Child.SomeEnum.SOME, NestedStruct = new Submodule.Child.AnotherStruct { StringProperty = "hello" } }); // Access via a renamed import Foo.Consumer.Consume(new ConsumerProps { Homonymous = new Homonymous { StringProperty = "yes" } }); diff --git a/packages/jsii-rosetta/test/translations/imports/submodule-import.go b/packages/jsii-rosetta/test/translations/imports/submodule-import.go index 4d09940446..a30100ccba 100644 --- a/packages/jsii-rosetta/test/translations/imports/submodule-import.go +++ b/packages/jsii-rosetta/test/translations/imports/submodule-import.go @@ -13,6 +13,9 @@ awsKmsKeyExamplekms := kms.NewKmsKey(this, jsii.String("examplekms"), map[string // Accesses two distinct points of the submodule hierarchy myClass := submodule.NewMyClass(&SomeStruct{ Prop: child.SomeEnum_SOME, + NestedStruct: &AnotherStruct{ + stringProperty: jsii.String("hello"), + }, }) // Access via a renamed import diff --git a/packages/jsii-rosetta/test/translations/imports/submodule-import.java b/packages/jsii-rosetta/test/translations/imports/submodule-import.java index e0c1acae67..38d999bb3d 100644 --- a/packages/jsii-rosetta/test/translations/imports/submodule-import.java +++ b/packages/jsii-rosetta/test/translations/imports/submodule-import.java @@ -11,7 +11,7 @@ .build(); // Accesses two distinct points of the submodule hierarchy -MyClass myClass = MyClass.Builder.create().prop(SomeEnum.SOME).build(); +MyClass myClass = MyClass.Builder.create().prop(SomeEnum.SOME).nestedStruct(new AnotherStruct().stringProperty("hello")).build(); // Access via a renamed import Consumer.consume(ConsumerProps.builder().homonymous(Homonymous.builder().stringProperty("yes").build()).build()); diff --git a/packages/jsii-rosetta/test/translations/imports/submodule-import.py b/packages/jsii-rosetta/test/translations/imports/submodule-import.py index 2ff0a54a0e..996c2b34d1 100644 --- a/packages/jsii-rosetta/test/translations/imports/submodule-import.py +++ b/packages/jsii-rosetta/test/translations/imports/submodule-import.py @@ -9,7 +9,7 @@ ) # Accesses two distinct points of the submodule hierarchy -my_class = calc.submodule.MyClass(prop=calc.submodule.child.SomeEnum.SOME) +my_class = calc.submodule.MyClass(prop=calc.submodule.child.SomeEnum.SOME, nested_struct=calc.submodule.child.AnotherStruct(string_property="hello")) # Access via a renamed import ns.foo.Consumer.consume(homonymous=ns.foo.Homonymous(string_property="yes")) diff --git a/packages/jsii-rosetta/test/translations/imports/submodule-import.ts b/packages/jsii-rosetta/test/translations/imports/submodule-import.ts index b552e577af..a7bd19f65e 100644 --- a/packages/jsii-rosetta/test/translations/imports/submodule-import.ts +++ b/packages/jsii-rosetta/test/translations/imports/submodule-import.ts @@ -9,7 +9,7 @@ const awsKmsKeyExamplekms = new aws.kms.KmsKey(this, 'examplekms', { }); // Accesses two distinct points of the submodule hierarchy -const myClass = new calc.submodule.MyClass({ prop: calc.submodule.child.SomeEnum.SOME }); +const myClass = new calc.submodule.MyClass({ prop: calc.submodule.child.SomeEnum.SOME, nestedStruct: { stringProperty: "hello" } }); // Access via a renamed import ns.foo.Consumer.consume({ homonymous: { stringProperty: 'yes' } });