From daca06f7c426d1fba509068ab842bd8dc7ddb62a Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Sun, 14 Mar 2021 19:43:03 +0200 Subject: [PATCH] fix(go): missing imports needed by base members (#2685) Go pacmak will reimplement methods and properties in case the class has more than a single "base" (interface/class). The Go code generator failed to include these members when determining which imports to generate. Additionally, if a constructor of a base class requires an import, it was also missing. Add a calc test fixture to verify (failed without this change). Fixes #2647 --- packages/@scope/jsii-calc-lib/lib/index.ts | 18 ++ .../@scope/jsii-calc-lib/test/assembly.jsii | 105 ++++++++--- packages/jsii-calc/lib/index.ts | 1 + packages/jsii-calc/lib/module2647/index.ts | 17 ++ packages/jsii-calc/test/assembly.jsii | 81 ++++++++- .../lib/targets/go/runtime/method-call.ts | 3 +- .../jsii-pacmak/lib/targets/go/types/class.ts | 15 +- .../lib/targets/go/types/type-member.ts | 7 +- .../__snapshots__/target-dotnet.test.ts.snap | 117 ++++++++++++ .../__snapshots__/target-go.test.ts.snap | 170 ++++++++++++++++++ .../__snapshots__/target-java.test.ts.snap | 103 +++++++++++ .../__snapshots__/target-python.test.ts.snap | 91 ++++++++++ .../test/__snapshots__/jsii-tree.test.ts.snap | 48 +++++ .../test/__snapshots__/tree.test.ts.snap | 33 ++++ .../__snapshots__/type-system.test.ts.snap | 2 + 15 files changed, 772 insertions(+), 39 deletions(-) create mode 100644 packages/jsii-calc/lib/module2647/index.ts diff --git a/packages/@scope/jsii-calc-lib/lib/index.ts b/packages/@scope/jsii-calc-lib/lib/index.ts index 7ffa4c17bd..beeee50442 100644 --- a/packages/@scope/jsii-calc-lib/lib/index.ts +++ b/packages/@scope/jsii-calc-lib/lib/index.ts @@ -1,4 +1,5 @@ import * as base from '@scope/jsii-calc-base'; +import { Very } from '@scope/jsii-calc-base-of-base'; /** * Abstract class which represents a numeric value. @@ -109,5 +110,22 @@ export interface IThreeLevelsInterface extends base.IBaseInterface { baz(): void; } +/** + * A base class for testing #2647. The method `foo` has a parameter that uses a type + * from a dependent module. Since Go "reimplments" this method, it will also need + * to include an "import" statement for the calc-base module. + * + * @see https://github.com/aws/jsii/issues/2647 + */ +export class BaseFor2647 { + public constructor(very: Very) { + very.hey(); + } + + public foo(obj: base.IBaseInterface): void { + obj.bar(); + } +} + export * as submodule from './submodule'; export * from './duplicate-inherited-prop'; diff --git a/packages/@scope/jsii-calc-lib/test/assembly.jsii b/packages/@scope/jsii-calc-lib/test/assembly.jsii index 38857c404c..95ac759049 100644 --- a/packages/@scope/jsii-calc-lib/test/assembly.jsii +++ b/packages/@scope/jsii-calc-lib/test/assembly.jsii @@ -93,7 +93,7 @@ "@scope/jsii-calc-lib.submodule": { "locationInModule": { "filename": "lib/index.ts", - "line": 112 + "line": 130 }, "targets": { "dotnet": { @@ -138,6 +138,59 @@ } }, "types": { + "@scope/jsii-calc-lib.BaseFor2647": { + "assembly": "@scope/jsii-calc-lib", + "docs": { + "remarks": "The method `foo` has a parameter that uses a type\nfrom a dependent module. Since Go \"reimplments\" this method, it will also need\nto include an \"import\" statement for the calc-base module.", + "see": "https://github.com/aws/jsii/issues/2647", + "stability": "deprecated", + "summary": "A base class for testing #2647." + }, + "fqn": "@scope/jsii-calc-lib.BaseFor2647", + "initializer": { + "docs": { + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/index.ts", + "line": 121 + }, + "parameters": [ + { + "name": "very", + "type": { + "fqn": "@scope/jsii-calc-base-of-base.Very" + } + } + ] + }, + "kind": "class", + "locationInModule": { + "filename": "lib/index.ts", + "line": 120 + }, + "methods": [ + { + "docs": { + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/index.ts", + "line": 125 + }, + "name": "foo", + "parameters": [ + { + "name": "obj", + "type": { + "fqn": "@scope/jsii-calc-base.IBaseInterface" + } + } + ] + } + ], + "name": "BaseFor2647" + }, "@scope/jsii-calc-lib.DiamondLeft": { "assembly": "@scope/jsii-calc-lib", "datatype": true, @@ -245,7 +298,7 @@ "kind": "enum", "locationInModule": { "filename": "lib/index.ts", - "line": 97 + "line": 98 }, "members": [ { @@ -273,7 +326,7 @@ "kind": "interface", "locationInModule": { "filename": "lib/index.ts", - "line": 23 + "line": 24 }, "name": "IDoublable", "properties": [ @@ -285,7 +338,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 24 + "line": 25 }, "name": "doubleValue", "type": { @@ -305,7 +358,7 @@ "kind": "interface", "locationInModule": { "filename": "lib/index.ts", - "line": 58 + "line": 59 }, "methods": [ { @@ -316,7 +369,7 @@ }, "locationInModule": { "filename": "lib/index.ts", - "line": 62 + "line": 63 }, "name": "hello", "returns": { @@ -342,7 +395,7 @@ "kind": "interface", "locationInModule": { "filename": "lib/index.ts", - "line": 108 + "line": 109 }, "methods": [ { @@ -352,7 +405,7 @@ }, "locationInModule": { "filename": "lib/index.ts", - "line": 109 + "line": 110 }, "name": "baz" } @@ -370,7 +423,7 @@ "kind": "interface", "locationInModule": { "filename": "lib/index.ts", - "line": 68 + "line": 69 }, "name": "MyFirstStruct", "properties": [ @@ -383,7 +436,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 77 + "line": 78 }, "name": "anumber", "type": { @@ -399,7 +452,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 72 + "line": 73 }, "name": "astring", "type": { @@ -414,7 +467,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 78 + "line": 79 }, "name": "firstOptional", "optional": true, @@ -444,7 +497,7 @@ }, "locationInModule": { "filename": "lib/index.ts", - "line": 35 + "line": 36 }, "parameters": [ { @@ -464,7 +517,7 @@ "kind": "class", "locationInModule": { "filename": "lib/index.ts", - "line": 30 + "line": 31 }, "name": "Number", "properties": [ @@ -476,7 +529,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 42 + "line": 43 }, "name": "doubleValue", "overrides": "@scope/jsii-calc-lib.IDoublable", @@ -492,7 +545,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 35 + "line": 36 }, "name": "value", "overrides": "@scope/jsii-calc-lib.NumericValue", @@ -515,7 +568,7 @@ "kind": "class", "locationInModule": { "filename": "lib/index.ts", - "line": 6 + "line": 7 }, "methods": [ { @@ -525,7 +578,7 @@ }, "locationInModule": { "filename": "lib/index.ts", - "line": 15 + "line": 16 }, "name": "toString", "returns": { @@ -546,7 +599,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 10 + "line": 11 }, "name": "value", "type": { @@ -568,7 +621,7 @@ "kind": "class", "locationInModule": { "filename": "lib/index.ts", - "line": 50 + "line": 51 }, "methods": [ { @@ -579,7 +632,7 @@ }, "locationInModule": { "filename": "lib/index.ts", - "line": 51 + "line": 52 }, "name": "toString", "overrides": "@scope/jsii-calc-lib.NumericValue", @@ -603,7 +656,7 @@ "kind": "interface", "locationInModule": { "filename": "lib/index.ts", - "line": 84 + "line": 85 }, "name": "StructWithOnlyOptionals", "properties": [ @@ -616,7 +669,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 88 + "line": 89 }, "name": "optional1", "optional": true, @@ -632,7 +685,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 89 + "line": 90 }, "name": "optional2", "optional": true, @@ -648,7 +701,7 @@ "immutable": true, "locationInModule": { "filename": "lib/index.ts", - "line": 90 + "line": 91 }, "name": "optional3", "optional": true, @@ -877,5 +930,5 @@ } }, "version": "0.0.0", - "fingerprint": "6We+OU9YxfTRfwXErreAyzcH2dVH29FgV8eiBRjowAY=" + "fingerprint": "yaW4nEkJcW4ZyHTJGV9YSAtkrzeBBoXkDffMJBD8dGQ=" } diff --git a/packages/jsii-calc/lib/index.ts b/packages/jsii-calc/lib/index.ts index 65d66f22cb..7f40a0c0a9 100644 --- a/packages/jsii-calc/lib/index.ts +++ b/packages/jsii-calc/lib/index.ts @@ -11,3 +11,4 @@ export * from './submodules'; export * as submodule from './submodule'; export * as onlystatic from './only-static'; export * as nodirect from './no-direct-types'; +export * as module2647 from './module2647'; diff --git a/packages/jsii-calc/lib/module2647/index.ts b/packages/jsii-calc/lib/module2647/index.ts new file mode 100644 index 0000000000..414359a0ae --- /dev/null +++ b/packages/jsii-calc/lib/module2647/index.ts @@ -0,0 +1,17 @@ +import { IFriendly, BaseFor2647 } from '@scope/jsii-calc-lib'; + +/** + * This class falls into the category of "multiple bases" from a different + * module from a go code gen perspective. + * + * @see https://github.com/aws/jsii/issues/2647 + */ +export class ExtendAndImplement extends BaseFor2647 implements IFriendly { + public localMethod() { + return 'hi'; + } + + public hello() { + return 'extends and implements'; + } +} diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 90975c3dba..ff8a023301 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -97,7 +97,7 @@ "@scope/jsii-calc-lib.submodule": { "locationInModule": { "filename": "lib/index.ts", - "line": 112 + "line": 130 }, "targets": { "dotnet": { @@ -211,6 +211,12 @@ "line": 142 } }, + "jsii-calc.module2647": { + "locationInModule": { + "filename": "lib/index.ts", + "line": 14 + } + }, "jsii-calc.nodirect": { "locationInModule": { "filename": "lib/index.ts", @@ -14119,6 +14125,77 @@ "name": "CompositionStringStyle", "namespace": "composition.CompositeOperation" }, + "jsii-calc.module2647.ExtendAndImplement": { + "assembly": "jsii-calc", + "base": "@scope/jsii-calc-lib.BaseFor2647", + "docs": { + "see": "https://github.com/aws/jsii/issues/2647", + "stability": "stable", + "summary": "This class falls into the category of \"multiple bases\" from a different module from a go code gen perspective." + }, + "fqn": "jsii-calc.module2647.ExtendAndImplement", + "initializer": { + "docs": { + "stability": "deprecated" + }, + "locationInModule": { + "filename": "lib/index.ts", + "line": 121 + }, + "parameters": [ + { + "name": "very", + "type": { + "fqn": "@scope/jsii-calc-base-of-base.Very" + } + } + ] + }, + "interfaces": [ + "@scope/jsii-calc-lib.IFriendly" + ], + "kind": "class", + "locationInModule": { + "filename": "lib/module2647/index.ts", + "line": 9 + }, + "methods": [ + { + "docs": { + "stability": "stable", + "summary": "(deprecated) Say hello!" + }, + "locationInModule": { + "filename": "lib/module2647/index.ts", + "line": 14 + }, + "name": "hello", + "overrides": "@scope/jsii-calc-lib.IFriendly", + "returns": { + "type": { + "primitive": "string" + } + } + }, + { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/module2647/index.ts", + "line": 10 + }, + "name": "localMethod", + "returns": { + "type": { + "primitive": "string" + } + } + } + ], + "name": "ExtendAndImplement", + "namespace": "module2647" + }, "jsii-calc.nodirect.sub1.TypeFromSub1": { "assembly": "jsii-calc", "docs": { @@ -14875,5 +14952,5 @@ } }, "version": "3.20.120", - "fingerprint": "uNidGL2tgHT8QUQRcLCiHny0p3nFE+RgNLoUqTDbHcM=" + "fingerprint": "jhFZc5fa0gXEmH6s8wlAhaQm8CX/ZCHNvpY1jXxwMgE=" } diff --git a/packages/jsii-pacmak/lib/targets/go/runtime/method-call.ts b/packages/jsii-pacmak/lib/targets/go/runtime/method-call.ts index 01b617e2ca..83abd692a3 100644 --- a/packages/jsii-pacmak/lib/targets/go/runtime/method-call.ts +++ b/packages/jsii-pacmak/lib/targets/go/runtime/method-call.ts @@ -1,4 +1,5 @@ import { CodeMaker } from 'codemaker'; +import { Method } from 'jsii-reflect'; import { GoMethod } from '../types'; import { @@ -86,7 +87,7 @@ export class MethodCall extends FunctionCall { } private get inStatic(): boolean { - return this.parent.method.static; + return Method.isMethod(this.parent.method) && this.parent.method.static; } private get argsString(): string { diff --git a/packages/jsii-pacmak/lib/targets/go/types/class.ts b/packages/jsii-pacmak/lib/targets/go/types/class.ts index 9dff125484..1141b81d63 100644 --- a/packages/jsii-pacmak/lib/targets/go/types/class.ts +++ b/packages/jsii-pacmak/lib/targets/go/types/class.ts @@ -15,7 +15,7 @@ import { getMemberDependencies, getParamDependencies } from '../util'; import { GoType } from './go-type'; import { GoTypeRef } from './go-type-reference'; import { GoInterface } from './interface'; -import { GoParameter, GoMethod, GoProperty, GoTypeMember } from './type-member'; +import { GoMethod, GoProperty, GoTypeMember } from './type-member'; /* * GoClass wraps a Typescript class as a Go custom struct type @@ -177,10 +177,13 @@ export class GoClass extends GoType { public get members(): GoTypeMember[] { return [ + ...(this.initializer ? [this.initializer] : []), ...this.methods, ...this.properties, ...this.staticMethods, ...this.staticProperties, + ...(this.reimplementedMethods ?? []), + ...(this.reimplementedProperties ?? []), ]; } @@ -324,18 +327,18 @@ export class GoClass extends GoType { } } -export class GoClassConstructor { +export class GoClassConstructor extends GoMethod { + public readonly usesInitPackage = true; + public readonly usesRuntimePackage = true; + private readonly constructorRuntimeCall: ClassConstructor; - public readonly parameters: GoParameter[]; public constructor( public readonly parent: GoClass, private readonly type: Initializer, ) { + super(parent, type); this.constructorRuntimeCall = new ClassConstructor(this); - this.parameters = this.type.parameters.map( - (param) => new GoParameter(parent, param), - ); } public emit(context: EmitContext) { diff --git a/packages/jsii-pacmak/lib/targets/go/types/type-member.ts b/packages/jsii-pacmak/lib/targets/go/types/type-member.ts index 5dc3f235b1..ed8a5a6cb6 100644 --- a/packages/jsii-pacmak/lib/targets/go/types/type-member.ts +++ b/packages/jsii-pacmak/lib/targets/go/types/type-member.ts @@ -1,5 +1,5 @@ import { toPascalCase } from 'codemaker'; -import { Method, Parameter, Property } from 'jsii-reflect'; +import { Callable, Method, Parameter, Property } from 'jsii-reflect'; import { EmitContext } from '../emit-context'; import { GetProperty, JSII_RT_ALIAS, SetProperty } from '../runtime'; @@ -145,11 +145,10 @@ export abstract class GoMethod implements GoTypeMember { public constructor( public readonly parent: GoClass | GoInterface, - public readonly method: Method, + public readonly method: Callable, ) { this.name = toPascalCase(method.name); - - if (method.returns.type) { + if (Method.isMethod(method) && method.returns.type) { this.reference = new GoTypeRef(parent.pkg.root, method.returns.type); } this.parameters = this.method.parameters.map( diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.ts.snap index 57e34d287b..cbcd354145 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.ts.snap @@ -973,6 +973,7 @@ exports[`Generated code for "@scope/jsii-calc-lib": / 1`] = ` ┃ ┗━ 📁 Tests ┃ ┣━ 📁 CalculatorNamespace ┃ ┃ ┗━ 📁 LibNamespace + ┃ ┃ ┣━ 📄 BaseFor2647.cs ┃ ┃ ┣━ 📄 DiamondLeft.cs ┃ ┃ ┣━ 📄 DiamondRight.cs ┃ ┃ ┣━ 📄 EnumFromScopedModule.cs @@ -1045,6 +1046,65 @@ exports[`Generated code for "@scope/jsii-calc-lib": /dotnet/Amazon.JSII. +`; + +exports[`Generated code for "@scope/jsii-calc-lib": /dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/BaseFor2647.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.LibNamespace +{ + /// (deprecated) A base class for testing #2647. + /// + /// The method foo has a parameter that uses a type + /// from a dependent module. Since Go "reimplments" this method, it will also need + /// to include an "import" statement for the calc-base module. + /// + /// Stability: Deprecated + /// + /// See: https://github.com/aws/jsii/issues/2647 + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.BaseFor2647), fullyQualifiedName: "@scope/jsii-calc-lib.BaseFor2647", parametersJson: "[{\\"name\\":\\"very\\",\\"type\\":{\\"fqn\\":\\"@scope/jsii-calc-base-of-base.Very\\"}}]")] + [System.Obsolete()] + public class BaseFor2647 : DeputyBase + { + /// + /// Stability: Deprecated + /// + [System.Obsolete()] + public BaseFor2647(Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very very): base(new DeputyProps(new object?[]{very})) + { + } + + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference + /// The Javascript-owned object reference + [System.Obsolete()] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected BaseFor2647(ByRefValue reference): base(reference) + { + } + + /// Used by jsii to construct an instance of this class from DeputyProps + /// The deputy props + [System.Obsolete()] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected BaseFor2647(DeputyProps props): base(props) + { + } + + /// + /// Stability: Deprecated + /// + [JsiiMethod(name: "foo", parametersJson: "[{\\"name\\":\\"obj\\",\\"type\\":{\\"fqn\\":\\"@scope/jsii-calc-base.IBaseInterface\\"}}]")] + [System.Obsolete()] + public virtual void Foo(Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.IBaseInterface obj) + { + InvokeInstanceVoidMethod(new System.Type[]{typeof(Amazon.JSII.Tests.CalculatorNamespace.BaseNamespace.IBaseInterface)}, new object[]{obj}); + } + } +} + `; exports[`Generated code for "@scope/jsii-calc-lib": /dotnet/Amazon.JSII.Tests.CalculatorPackageId.LibPackageId/Amazon/JSII/Tests/CalculatorNamespace/LibNamespace/DiamondLeft.cs 1`] = ` @@ -2833,6 +2893,8 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 LevelOneProps.cs ┃ ┣━ 📄 LoadBalancedFargateServiceProps.cs ┃ ┣━ 📄 MethodNamedProperty.cs + ┃ ┣━ 📁 Module2647 + ┃ ┃ ┗━ 📄 ExtendAndImplement.cs ┃ ┣━ 📄 Multiply.cs ┃ ┣━ 📄 NamespaceDoc.cs ┃ ┣━ 📄 Negate.cs @@ -12059,6 +12121,61 @@ namespace Amazon.JSII.Tests.CalculatorNamespace `; +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Module2647/ExtendAndImplement.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.Module2647 +{ + /// This class falls into the category of "multiple bases" from a different module from a go code gen perspective. + /// + /// See: https://github.com/aws/jsii/issues/2647 + /// + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.Module2647.ExtendAndImplement), fullyQualifiedName: "jsii-calc.module2647.ExtendAndImplement", parametersJson: "[{\\"name\\":\\"very\\",\\"type\\":{\\"fqn\\":\\"@scope/jsii-calc-base-of-base.Very\\"}}]")] + public class ExtendAndImplement : Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.BaseFor2647, Amazon.JSII.Tests.CalculatorNamespace.LibNamespace.IFriendly + { + /// + /// Stability: Deprecated + /// + [System.Obsolete()] + public ExtendAndImplement(Amazon.JSII.Tests.CalculatorNamespace.BaseOfBaseNamespace.Very very): base(new DeputyProps(new object?[]{very})) + { + } + + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference + /// The Javascript-owned object reference + [System.Obsolete()] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected ExtendAndImplement(ByRefValue reference): base(reference) + { + } + + /// Used by jsii to construct an instance of this class from DeputyProps + /// The deputy props + [System.Obsolete()] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected ExtendAndImplement(DeputyProps props): base(props) + { + } + + /// (deprecated) Say hello! + [JsiiMethod(name: "hello", returnsJson: "{\\"type\\":{\\"primitive\\":\\"string\\"}}", isOverride: true)] + public virtual string Hello() + { + return InvokeInstanceMethod(new System.Type[]{}, new object[]{})!; + } + + [JsiiMethod(name: "localMethod", returnsJson: "{\\"type\\":{\\"primitive\\":\\"string\\"}}")] + public virtual string LocalMethod() + { + return InvokeInstanceMethod(new System.Type[]{}, new object[]{})!; + } + } +} + +`; + exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/Multiply.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap index 06017a0d79..1aa712043b 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap @@ -1335,8 +1335,52 @@ import ( _init_ "github.com/aws/jsii/jsii-calc/go/scopejsiicalclib/jsii" "github.com/aws/jsii/jsii-calc/go/jcb" + "github.com/aws/jsii/jsii-calc/go/scopejsiicalcbaseofbase/v2" ) +// A base class for testing #2647. +// +// The method \`foo\` has a parameter that uses a type +// from a dependent module. Since Go "reimplments" this method, it will also need +// to include an "import" statement for the calc-base module. +// See: https://github.com/aws/jsii/issues/2647 +// +// Deprecated. +type BaseFor2647 interface { + Foo(obj jcb.IBaseInterface) +} + +// The jsii proxy struct for BaseFor2647 +type jsiiProxy_BaseFor2647 struct { + _ byte // padding +} + +// Deprecated. +func NewBaseFor2647(very scopejsiicalcbaseofbase.Very) BaseFor2647 { + _init_.Initialize() + + j := jsiiProxy_BaseFor2647{} + + _jsii_.Create( + "@scope/jsii-calc-lib.BaseFor2647", + []interface{}{very}, + []_jsii_.FQN{}, + nil, // no overrides + &j, + ) + + return &j +} + +// Deprecated. +func (b *jsiiProxy_BaseFor2647) Foo(obj jcb.IBaseInterface) { + _jsii_.InvokeVoid( + b, + "foo", + []interface{}{obj}, + ) +} + // Deprecated. type DiamondLeft struct { // Deprecated. @@ -1661,6 +1705,16 @@ import ( ) func init() { + _jsii_.RegisterClass( + "@scope/jsii-calc-lib.BaseFor2647", + reflect.TypeOf((*BaseFor2647)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "foo", GoMethod: "Foo"}, + }, + func() interface{} { + return &jsiiProxy_BaseFor2647{} + }, + ) _jsii_.RegisterStruct( "@scope/jsii-calc-lib.DiamondLeft", reflect.TypeOf((*DiamondLeft)(nil)).Elem(), @@ -1795,6 +1849,9 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┣━ 📄 jsiicalc.go ┣━ 📄 jsiicalc.init.go ┣━ 📄 LICENSE + ┣━ 📁 module2647 + ┃ ┣━ 📄 module2647.go + ┃ ┗━ 📄 module2647.init.go ┣━ 📁 nodirect ┃ ┣━ 📄 nodirect.go ┃ ┣━ 📁 sub1 @@ -14743,6 +14800,119 @@ func init() { `; +exports[`Generated code for "jsii-calc": /go/jsiicalc/module2647/module2647.go 1`] = ` +package module2647 + +import ( + _jsii_ "github.com/aws/jsii-runtime-go" + _init_ "github.com/aws/jsii/jsii-calc/go/jsiicalc/v3/jsii" + + "github.com/aws/jsii/jsii-calc/go/jcb" + "github.com/aws/jsii/jsii-calc/go/scopejsiicalcbaseofbase/v2" + "github.com/aws/jsii/jsii-calc/go/scopejsiicalclib" +) + +// This class falls into the category of "multiple bases" from a different module from a go code gen perspective. +// See: https://github.com/aws/jsii/issues/2647 +// +type ExtendAndImplement interface { + scopejsiicalclib.BaseFor2647 + scopejsiicalclib.IFriendly + Hello() string + LocalMethod() string +} + +// The jsii proxy struct for ExtendAndImplement +type jsiiProxy_ExtendAndImplement struct { + scopejsiicalclib.BaseFor2647 // extends @scope/jsii-calc-lib.BaseFor2647 + scopejsiicalclib.IFriendly // implements @scope/jsii-calc-lib.IFriendly +} + +// Deprecated. +func NewExtendAndImplement(very scopejsiicalcbaseofbase.Very) ExtendAndImplement { + _init_.Initialize() + + j := jsiiProxy_ExtendAndImplement{} + + _jsii_.Create( + "jsii-calc.module2647.ExtendAndImplement", + []interface{}{very}, + []_jsii_.FQN{"@scope/jsii-calc-lib.IFriendly"}, + nil, // no overrides + &j, + ) + + return &j +} + +// (deprecated) Say hello! +func (e *jsiiProxy_ExtendAndImplement) Hello() string { + var returns string + + _jsii_.Invoke( + e, + "hello", + nil /* no parameters */, + &returns, + ) + + return returns +} + +func (e *jsiiProxy_ExtendAndImplement) LocalMethod() string { + var returns string + + _jsii_.Invoke( + e, + "localMethod", + nil /* no parameters */, + &returns, + ) + + return returns +} + +// Deprecated. +func (e *jsiiProxy_ExtendAndImplement) Foo(obj jcb.IBaseInterface) { + _jsii_.InvokeVoid( + e, + "foo", + []interface{}{obj}, + ) +} + + +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/module2647/module2647.init.go 1`] = ` +package module2647 + +import ( + "reflect" + + _jsii_ "github.com/aws/jsii-runtime-go" +) + +func init() { + _jsii_.RegisterClass( + "jsii-calc.module2647.ExtendAndImplement", + reflect.TypeOf((*ExtendAndImplement)(nil)).Elem(), + []_jsii_.Member{ + _jsii_.MemberMethod{JsiiMethod: "foo", GoMethod: "Foo"}, + _jsii_.MemberMethod{JsiiMethod: "hello", GoMethod: "Hello"}, + _jsii_.MemberMethod{JsiiMethod: "localMethod", GoMethod: "LocalMethod"}, + }, + func() interface{} { + j := jsiiProxy_ExtendAndImplement{} + _jsii_.InitJsiiProxy(&j.BaseFor2647) + _jsii_.InitJsiiProxy(&j.IFriendly) + return &j + }, + ) +} + +`; + exports[`Generated code for "jsii-calc": /go/jsiicalc/nodirect/nodirect.go 1`] = ` package nodirect diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.ts.snap index b734ed9816..ad1b732858 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.ts.snap @@ -1422,6 +1422,7 @@ exports[`Generated code for "@scope/jsii-calc-lib": / 1`] = ` ┃ ┃ ┗━ 📄 Reflector.java ┃ ┗━ 📁 lib ┃ ┣━ 📄 $Module.java + ┃ ┣━ 📄 BaseFor2647.java ┃ ┣━ 📄 DiamondLeft.java ┃ ┣━ 📄 DiamondRight.java ┃ ┣━ 📄 EnumFromScopedModule.java @@ -2328,6 +2329,54 @@ public final class $Module extends JsiiModule { `; +exports[`Generated code for "@scope/jsii-calc-lib": /java/src/main/java/software/amazon/jsii/tests/calculator/lib/BaseFor2647.java 1`] = ` +package software.amazon.jsii.tests.calculator.lib; + +/** + * (deprecated) A base class for testing #2647. + *

+ * The method foo has a parameter that uses a type + * from a dependent module. Since Go "reimplments" this method, it will also need + * to include an "import" statement for the calc-base module. + *

+ * @see https://github.com/aws/jsii/issues/2647 + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) +@Deprecated +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.lib.$Module.class, fqn = "@scope/jsii-calc-lib.BaseFor2647") +public class BaseFor2647 extends software.amazon.jsii.JsiiObject { + + protected BaseFor2647(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + } + + protected BaseFor2647(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { + super(initializationMode); + } + + /** + * @param very This parameter is required. + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + @Deprecated + public BaseFor2647(final @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.baseofbase.Very very) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(very, "very is required") }); + } + + /** + * @param obj This parameter is required. + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + @Deprecated + public void foo(final @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.base.IBaseInterface obj) { + software.amazon.jsii.Kernel.call(this, "foo", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(obj, "obj is required") }); + } +} + +`; + exports[`Generated code for "@scope/jsii-calc-lib": /java/src/main/java/software/amazon/jsii/tests/calculator/lib/DiamondLeft.java 1`] = ` package software.amazon.jsii.tests.calculator.lib; @@ -3481,6 +3530,7 @@ package software.amazon.jsii.tests.calculator.lib; `; exports[`Generated code for "@scope/jsii-calc-lib": /java/src/main/resources/software/amazon/jsii/tests/calculator/lib/$Module.txt 1`] = ` +@scope/jsii-calc-lib.BaseFor2647=software.amazon.jsii.tests.calculator.lib.BaseFor2647 @scope/jsii-calc-lib.DiamondLeft=software.amazon.jsii.tests.calculator.lib.DiamondLeft @scope/jsii-calc-lib.DiamondRight=software.amazon.jsii.tests.calculator.lib.DiamondRight @scope/jsii-calc-lib.EnumFromScopedModule=software.amazon.jsii.tests.calculator.lib.EnumFromScopedModule @@ -3660,6 +3710,8 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ 📄 LevelOneProps.java ┃ ┣━ 📄 LoadBalancedFargateServiceProps.java ┃ ┣━ 📄 MethodNamedProperty.java + ┃ ┣━ 📁 module2647 + ┃ ┃ ┗━ 📄 ExtendAndImplement.java ┃ ┣━ 📄 Multiply.java ┃ ┣━ 📄 Negate.java ┃ ┣━ 📄 NestedClassInstance.java @@ -21662,6 +21714,56 @@ public interface Hello extends software.amazon.jsii.JsiiSerializable { `; +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/module2647/ExtendAndImplement.java 1`] = ` +package software.amazon.jsii.tests.calculator.module2647; + +/** + * This class falls into the category of "multiple bases" from a different module from a go code gen perspective. + *

+ * @see https://github.com/aws/jsii/issues/2647 + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.module2647.ExtendAndImplement") +public class ExtendAndImplement extends software.amazon.jsii.tests.calculator.lib.BaseFor2647 implements software.amazon.jsii.tests.calculator.lib.IFriendly { + + protected ExtendAndImplement(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + } + + protected ExtendAndImplement(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { + super(initializationMode); + } + + /** + * @param very This parameter is required. + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) + @Deprecated + public ExtendAndImplement(final @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.baseofbase.Very very) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(very, "very is required") }); + } + + /** + * (deprecated) Say hello! + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @Override + public @org.jetbrains.annotations.NotNull java.lang.String hello() { + return software.amazon.jsii.Kernel.call(this, "hello", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); + } + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public @org.jetbrains.annotations.NotNull java.lang.String localMethod() { + return software.amazon.jsii.Kernel.call(this, "localMethod", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); + } +} + +`; + exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/nodirect/sub1/TypeFromSub1.java 1`] = ` package software.amazon.jsii.tests.calculator.nodirect.sub1; @@ -23511,6 +23613,7 @@ jsii-calc.VoidCallback=software.amazon.jsii.tests.calculator.VoidCallback jsii-calc.WithPrivatePropertyInConstructor=software.amazon.jsii.tests.calculator.WithPrivatePropertyInConstructor jsii-calc.composition.CompositeOperation=software.amazon.jsii.tests.calculator.composition.CompositeOperation jsii-calc.composition.CompositeOperation.CompositionStringStyle=software.amazon.jsii.tests.calculator.composition.CompositeOperation$CompositionStringStyle +jsii-calc.module2647.ExtendAndImplement=software.amazon.jsii.tests.calculator.module2647.ExtendAndImplement jsii-calc.nodirect.sub1.TypeFromSub1=software.amazon.jsii.tests.calculator.nodirect.sub1.TypeFromSub1 jsii-calc.nodirect.sub2.TypeFromSub2=software.amazon.jsii.tests.calculator.nodirect.sub2.TypeFromSub2 jsii-calc.onlystatic.OnlyStaticMethods=software.amazon.jsii.tests.calculator.onlystatic.OnlyStaticMethods diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap index 6f302ae5a9..c853d1f10e 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.ts.snap @@ -1264,6 +1264,39 @@ import typing_extensions from ._jsii import * import scope.jsii_calc_base +import scope.jsii_calc_base_of_base + + +class BaseFor2647( + metaclass=jsii.JSIIMeta, + jsii_type="@scope/jsii-calc-lib.BaseFor2647", +): + '''(deprecated) A base class for testing #2647. + + The method \`\`foo\`\` has a parameter that uses a type + from a dependent module. Since Go "reimplments" this method, it will also need + to include an "import" statement for the calc-base module. + + :see: https://github.com/aws/jsii/issues/2647 + :stability: deprecated + ''' + + def __init__(self, very: scope.jsii_calc_base_of_base.Very) -> None: + ''' + :param very: - + + :stability: deprecated + ''' + jsii.create(BaseFor2647, self, [very]) + + @jsii.member(jsii_name="foo") + def foo(self, obj: scope.jsii_calc_base.IBaseInterface) -> None: + ''' + :param obj: - + + :stability: deprecated + ''' + return typing.cast(None, jsii.invoke(self, "foo", [obj])) @jsii.data_type( @@ -1785,6 +1818,7 @@ class Number( __all__ = [ + "BaseFor2647", "DiamondLeft", "DiamondRight", "EnumFromScopedModule", @@ -2067,6 +2101,8 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┗━ 📄 __init__.py ┣━ 📁 interface_in_namespace_only_interface ┃ ┗━ 📄 __init__.py + ┣━ 📁 module2647 + ┃ ┗━ 📄 __init__.py ┣━ 📁 nodirect ┃ ┣━ 📄 __init__.py ┃ ┣━ 📁 sub1 @@ -2380,6 +2416,7 @@ kwargs = json.loads( "jsii_calc.derived_class_has_no_properties", "jsii_calc.interface_in_namespace_includes_classes", "jsii_calc.interface_in_namespace_only_interface", + "jsii_calc.module2647", "jsii_calc.nodirect", "jsii_calc.nodirect.sub1", "jsii_calc.nodirect.sub2", @@ -10327,6 +10364,60 @@ publication.publish() `; +exports[`Generated code for "jsii-calc": /python/src/jsii_calc/module2647/__init__.py 1`] = ` +import abc +import builtins +import datetime +import enum +import typing + +import jsii +import publication +import typing_extensions + +from .._jsii import * + +import scope.jsii_calc_base_of_base +import scope.jsii_calc_lib + + +@jsii.implements(scope.jsii_calc_lib.IFriendly) +class ExtendAndImplement( + scope.jsii_calc_lib.BaseFor2647, + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.module2647.ExtendAndImplement", +): + '''This class falls into the category of "multiple bases" from a different module from a go code gen perspective. + + :see: https://github.com/aws/jsii/issues/2647 + ''' + + def __init__(self, very: scope.jsii_calc_base_of_base.Very) -> None: + ''' + :param very: - + + :stability: deprecated + ''' + jsii.create(ExtendAndImplement, self, [very]) + + @jsii.member(jsii_name="hello") + def hello(self) -> builtins.str: + '''(deprecated) Say hello!''' + return typing.cast(builtins.str, jsii.invoke(self, "hello", [])) + + @jsii.member(jsii_name="localMethod") + def local_method(self) -> builtins.str: + return typing.cast(builtins.str, jsii.invoke(self, "localMethod", [])) + + +__all__ = [ + "ExtendAndImplement", +] + +publication.publish() + +`; + exports[`Generated code for "jsii-calc": /python/src/jsii_calc/nodirect/__init__.py 1`] = ` import abc import builtins diff --git a/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.ts.snap b/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.ts.snap index 415a3c44c6..2463cf3987 100644 --- a/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.ts.snap +++ b/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.ts.snap @@ -102,6 +102,20 @@ exports[`jsii-tree --all 1`] = ` │ │ │ └─┬ enum CompositionStringStyle (stable) │ │ │ ├── NORMAL (stable) │ │ │ └── DECORATED (stable) + │ │ ├─┬ module2647 + │ │ │ └─┬ types + │ │ │ └─┬ class ExtendAndImplement (stable) + │ │ │ ├── base: BaseFor2647 + │ │ │ ├── interfaces: IFriendly + │ │ │ └─┬ members + │ │ │ ├─┬ (very) initializer (deprecated) + │ │ │ │ └─┬ parameters + │ │ │ │ └─┬ very + │ │ │ │ └── type: @scope/jsii-calc-base-of-base.Very + │ │ │ ├─┬ hello() method (stable) + │ │ │ │ └── returns: string + │ │ │ └─┬ localMethod() method (stable) + │ │ │ └── returns: string │ │ ├─┬ nodirect │ │ │ ├─┬ submodules │ │ │ │ ├─┬ sub1 @@ -2803,6 +2817,17 @@ exports[`jsii-tree --all 1`] = ` │ ├── immutable │ └── type: any └─┬ types + ├─┬ class BaseFor2647 (deprecated) + │ └─┬ members + │ ├─┬ (very) initializer (deprecated) + │ │ └─┬ parameters + │ │ └─┬ very + │ │ └── type: @scope/jsii-calc-base-of-base.Very + │ └─┬ foo(obj) method (deprecated) + │ ├─┬ parameters + │ │ └─┬ obj + │ │ └── type: @scope/jsii-calc-base.IBaseInterface + │ └── returns: void ├─┬ class Number (deprecated) │ ├── base: NumericValue │ ├── interfaces: IDoublable @@ -2933,6 +2958,11 @@ exports[`jsii-tree --inheritance 1`] = ` │ │ │ ├─┬ class CompositeOperation │ │ │ │ └── base: Operation │ │ │ └── enum CompositionStringStyle + │ │ ├─┬ module2647 + │ │ │ └─┬ types + │ │ │ └─┬ class ExtendAndImplement + │ │ │ ├── base: BaseFor2647 + │ │ │ └── interfaces: IFriendly │ │ ├─┬ nodirect │ │ │ ├─┬ submodules │ │ │ │ ├─┬ sub1 @@ -3277,6 +3307,7 @@ exports[`jsii-tree --inheritance 1`] = ` │ ├── interface NestedStruct │ └── interface ReflectableEntry └─┬ types + ├── class BaseFor2647 ├─┬ class Number │ ├── base: NumericValue │ └── interfaces: IDoublable @@ -3355,6 +3386,13 @@ exports[`jsii-tree --members 1`] = ` │ │ │ └─┬ enum CompositionStringStyle │ │ │ ├── NORMAL │ │ │ └── DECORATED + │ │ ├─┬ module2647 + │ │ │ └─┬ types + │ │ │ └─┬ class ExtendAndImplement + │ │ │ └─┬ members + │ │ │ ├── (very) initializer + │ │ │ ├── hello() method + │ │ │ └── localMethod() method │ │ ├─┬ nodirect │ │ │ ├─┬ submodules │ │ │ │ ├─┬ sub1 @@ -4566,6 +4604,10 @@ exports[`jsii-tree --members 1`] = ` │ ├── key property │ └── value property └─┬ types + ├─┬ class BaseFor2647 + │ └─┬ members + │ ├── (very) initializer + │ └── foo(obj) method ├─┬ class Number │ └─┬ members │ ├── (value) initializer @@ -4622,6 +4664,7 @@ exports[`jsii-tree --signatures 1`] = ` │ ├── InterfaceInNamespaceOnlyInterface │ ├── PythonSelf │ ├── composition + │ ├── module2647 │ ├─┬ nodirect │ │ └─┬ submodules │ │ ├── sub1 @@ -4670,6 +4713,9 @@ exports[`jsii-tree --types 1`] = ` │ │ │ └─┬ types │ │ │ ├── class CompositeOperation │ │ │ └── enum CompositionStringStyle + │ │ ├─┬ module2647 + │ │ │ └─┬ types + │ │ │ └── class ExtendAndImplement │ │ ├─┬ nodirect │ │ │ ├─┬ submodules │ │ │ │ ├─┬ sub1 @@ -4947,6 +4993,7 @@ exports[`jsii-tree --types 1`] = ` │ ├── interface NestedStruct │ └── interface ReflectableEntry └─┬ types + ├── class BaseFor2647 ├── class Number ├── class NumericValue ├── class Operation @@ -4970,6 +5017,7 @@ exports[`jsii-tree 1`] = ` │ ├── InterfaceInNamespaceOnlyInterface │ ├── PythonSelf │ ├── composition + │ ├── module2647 │ ├─┬ nodirect │ │ └─┬ submodules │ │ ├── sub1 diff --git a/packages/jsii-reflect/test/__snapshots__/tree.test.ts.snap b/packages/jsii-reflect/test/__snapshots__/tree.test.ts.snap index 0f057f66c1..6eaa378b93 100644 --- a/packages/jsii-reflect/test/__snapshots__/tree.test.ts.snap +++ b/packages/jsii-reflect/test/__snapshots__/tree.test.ts.snap @@ -9,6 +9,7 @@ exports[`defaults 1`] = ` │ ├── InterfaceInNamespaceOnlyInterface │ ├── PythonSelf │ ├── composition + │ ├── module2647 │ ├─┬ nodirect │ │ └─┬ submodules │ │ ├── sub1 @@ -41,6 +42,7 @@ exports[`inheritance 1`] = ` │ ├── InterfaceInNamespaceOnlyInterface │ ├── PythonSelf │ ├── composition + │ ├── module2647 │ ├─┬ nodirect │ │ └─┬ submodules │ │ ├── sub1 @@ -73,6 +75,7 @@ exports[`members 1`] = ` │ ├── InterfaceInNamespaceOnlyInterface │ ├── PythonSelf │ ├── composition + │ ├── module2647 │ ├─┬ nodirect │ │ └─┬ submodules │ │ ├── sub1 @@ -198,6 +201,20 @@ exports[`showAll 1`] = ` │ │ │ └─┬ enum CompositionStringStyle │ │ │ ├── NORMAL │ │ │ └── DECORATED + │ │ ├─┬ module2647 + │ │ │ └─┬ types + │ │ │ └─┬ class ExtendAndImplement + │ │ │ ├── base: BaseFor2647 + │ │ │ ├── interfaces: IFriendly + │ │ │ └─┬ members + │ │ │ ├─┬ (very) initializer + │ │ │ │ └─┬ parameters + │ │ │ │ └─┬ very + │ │ │ │ └── type: @scope/jsii-calc-base-of-base.Very + │ │ │ ├─┬ hello() method + │ │ │ │ └── returns: string + │ │ │ └─┬ localMethod() method + │ │ │ └── returns: string │ │ ├─┬ nodirect │ │ │ ├─┬ submodules │ │ │ │ ├─┬ sub1 @@ -2899,6 +2916,17 @@ exports[`showAll 1`] = ` │ ├── immutable │ └── type: any └─┬ types + ├─┬ class BaseFor2647 + │ └─┬ members + │ ├─┬ (very) initializer + │ │ └─┬ parameters + │ │ └─┬ very + │ │ └── type: @scope/jsii-calc-base-of-base.Very + │ └─┬ foo(obj) method + │ ├─┬ parameters + │ │ └─┬ obj + │ │ └── type: @scope/jsii-calc-base.IBaseInterface + │ └── returns: void ├─┬ class Number │ ├── base: NumericValue │ ├── interfaces: IDoublable @@ -3011,6 +3039,7 @@ exports[`signatures 1`] = ` │ ├── InterfaceInNamespaceOnlyInterface │ ├── PythonSelf │ ├── composition + │ ├── module2647 │ ├─┬ nodirect │ │ └─┬ submodules │ │ ├── sub1 @@ -3059,6 +3088,9 @@ exports[`types 1`] = ` │ │ │ └─┬ types │ │ │ ├── class CompositeOperation │ │ │ └── enum CompositionStringStyle + │ │ ├─┬ module2647 + │ │ │ └─┬ types + │ │ │ └── class ExtendAndImplement │ │ ├─┬ nodirect │ │ │ ├─┬ submodules │ │ │ │ ├─┬ sub1 @@ -3336,6 +3368,7 @@ exports[`types 1`] = ` │ ├── interface NestedStruct │ └── interface ReflectableEntry └─┬ types + ├── class BaseFor2647 ├── class Number ├── class NumericValue ├── class Operation diff --git a/packages/jsii-reflect/test/__snapshots__/type-system.test.ts.snap b/packages/jsii-reflect/test/__snapshots__/type-system.test.ts.snap index f7ceb755ab..0cb209e9d1 100644 --- a/packages/jsii-reflect/test/__snapshots__/type-system.test.ts.snap +++ b/packages/jsii-reflect/test/__snapshots__/type-system.test.ts.snap @@ -15,6 +15,7 @@ Array [ "@scope/jsii-calc-base-of-base.Very", "@scope/jsii-calc-base.Base", "@scope/jsii-calc-base.StaticConsumer", + "@scope/jsii-calc-lib.BaseFor2647", "@scope/jsii-calc-lib.Number", "@scope/jsii-calc-lib.NumericValue", "@scope/jsii-calc-lib.Operation", @@ -153,6 +154,7 @@ Array [ "jsii-calc.VoidCallback", "jsii-calc.WithPrivatePropertyInConstructor", "jsii-calc.composition.CompositeOperation", + "jsii-calc.module2647.ExtendAndImplement", "jsii-calc.nodirect.sub1.TypeFromSub1", "jsii-calc.nodirect.sub2.TypeFromSub2", "jsii-calc.onlystatic.OnlyStaticMethods",