From f173c72c5b73a753533388c3f48012127eada17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BB=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier?= Date: Wed, 2 Nov 2022 10:06:28 +0100 Subject: [PATCH 1/2] fix(python): type-checking may require incorrect type Since dae724c39ba274c6facd8fb9f4b93cc2db52e311, Python type-checking relies on a nested stub function as a type annotations source. The parameter signature of that stub was copied verbatim from the surrounding function, including any forward type references. However, the forward references can safely be replaced with regular type references as the module is guaranteed to be fully loaded by the time the stub is created, and using forward-references there results in `typeguard` possibly evaluating those in a different context than the one where the surrounding function was defined. The consequence of this is that multiple different foward references by the same name may be incorrectly treated as referring to the same type, despite coming from different modules. This is fixed by turning forward type references in the stub with regular type references (in other words, removing any `"` from the parameter signature of the stub), which lets the type be resolved from the local definition context instead of the final runtime context in which the function is called. Fixes #3818 --- .../tests/test_runtime_type_checking.py | 15 + packages/jsii-calc/lib/homonymous/README.md | 4 + packages/jsii-calc/lib/homonymous/bar.ts | 15 + packages/jsii-calc/lib/homonymous/foo.ts | 15 + packages/jsii-calc/lib/homonymous/index.ts | 2 + packages/jsii-calc/lib/index.ts | 1 + packages/jsii-calc/test/assembly.jsii | 240 +++++++- packages/jsii-pacmak/lib/targets/python.ts | 13 +- .../__snapshots__/target-dotnet.test.js.snap | 329 ++++++++++ .../__snapshots__/target-go.test.js.snap | 325 ++++++++++ .../__snapshots__/target-java.test.js.snap | 569 ++++++++++++++++++ .../__snapshots__/target-python.test.js.snap | 450 ++++++++++++-- .../test/__snapshots__/jsii-tree.test.js.snap | 106 ++++ .../test/__snapshots__/tree.test.js.snap | 76 +++ .../__snapshots__/type-system.test.js.snap | 2 + 15 files changed, 2115 insertions(+), 47 deletions(-) create mode 100644 packages/jsii-calc/lib/homonymous/README.md create mode 100644 packages/jsii-calc/lib/homonymous/bar.ts create mode 100644 packages/jsii-calc/lib/homonymous/foo.ts create mode 100644 packages/jsii-calc/lib/homonymous/index.ts diff --git a/packages/@jsii/python-runtime/tests/test_runtime_type_checking.py b/packages/@jsii/python-runtime/tests/test_runtime_type_checking.py index 80165eacd6..ccc1f8e9f1 100644 --- a/packages/@jsii/python-runtime/tests/test_runtime_type_checking.py +++ b/packages/@jsii/python-runtime/tests/test_runtime_type_checking.py @@ -172,3 +172,18 @@ def test_variadic(self): ) jsii_calc.VariadicTypeUnion() + + def test_homonymous_forward_references(self): + """Verifies homonymous forward references don't trip the type checker + + This has been an issue when stub functions were introduced to create a reliable source for type checking + information, which was reported in https://github.com/aws/jsii/issues/3818. + """ + # This uses a ForwardRef["Homonymous"] that should resolve to jsii_calc.homonymous_forward_references.foo.Homonymous + jsii_calc.homonymous_forward_references.foo.Consumer.consume( + homonymous={"string_property": "Check!"} + ) + # This uses a ForwardRef["Homonymous"] that should resolve to jsii_calc.homonymous_forward_references.bar.Homonymous + jsii_calc.homonymous_forward_references.bar.Consumer.consume( + homonymous={"numeric_property": 1337} + ) diff --git a/packages/jsii-calc/lib/homonymous/README.md b/packages/jsii-calc/lib/homonymous/README.md new file mode 100644 index 0000000000..c1cf269535 --- /dev/null +++ b/packages/jsii-calc/lib/homonymous/README.md @@ -0,0 +1,4 @@ +Verifies homonymous forward references don't trip the Python type checker + +This has been an issue when stub functions were introduced to create a reliable source for type checking +information, which was reported in https://github.com/aws/jsii/issues/3818. diff --git a/packages/jsii-calc/lib/homonymous/bar.ts b/packages/jsii-calc/lib/homonymous/bar.ts new file mode 100644 index 0000000000..a71da03dc2 --- /dev/null +++ b/packages/jsii-calc/lib/homonymous/bar.ts @@ -0,0 +1,15 @@ +export interface Homonymous { + readonly numericProperty: number; +} + +export interface ConsumerProps { + readonly homonymous: Homonymous; +} + +export class Consumer { + public static consume(props: ConsumerProps) { + return props.homonymous; + } + + private constructor() {} +} diff --git a/packages/jsii-calc/lib/homonymous/foo.ts b/packages/jsii-calc/lib/homonymous/foo.ts new file mode 100644 index 0000000000..f0e12f14ca --- /dev/null +++ b/packages/jsii-calc/lib/homonymous/foo.ts @@ -0,0 +1,15 @@ +export interface Homonymous { + readonly stringProperty: string; +} + +export interface ConsumerProps { + readonly homonymous: Homonymous; +} + +export class Consumer { + public static consume(props: ConsumerProps) { + return props.homonymous; + } + + private constructor() {} +} diff --git a/packages/jsii-calc/lib/homonymous/index.ts b/packages/jsii-calc/lib/homonymous/index.ts new file mode 100644 index 0000000000..4728bb9f1d --- /dev/null +++ b/packages/jsii-calc/lib/homonymous/index.ts @@ -0,0 +1,2 @@ +export * as bar from './bar'; +export * as foo from './foo'; diff --git a/packages/jsii-calc/lib/index.ts b/packages/jsii-calc/lib/index.ts index 9c487d7c6c..6aec391e1e 100644 --- a/packages/jsii-calc/lib/index.ts +++ b/packages/jsii-calc/lib/index.ts @@ -26,3 +26,4 @@ export * as jsii3656 from './jsii3656'; export * as anonymous from './anonymous'; export * as union from './union'; +export * as homonymousForwardReferences from './homonymous'; diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index d98342303c..357bf1e6d6 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -235,6 +235,30 @@ }, "symbolId": "lib/calculator:composition" }, + "jsii-calc.homonymousForwardReferences": { + "locationInModule": { + "filename": "lib/index.ts", + "line": 29 + }, + "readme": { + "markdown": "Verifies homonymous forward references don't trip the Python type checker\n\nThis has been an issue when stub functions were introduced to create a reliable source for type checking\ninformation, which was reported in https://github.com/aws/jsii/issues/3818.\n" + }, + "symbolId": "lib/homonymous/index:" + }, + "jsii-calc.homonymousForwardReferences.bar": { + "locationInModule": { + "filename": "lib/homonymous/index.ts", + "line": 1 + }, + "symbolId": "lib/homonymous/bar:" + }, + "jsii-calc.homonymousForwardReferences.foo": { + "locationInModule": { + "filename": "lib/homonymous/index.ts", + "line": 2 + }, + "symbolId": "lib/homonymous/foo:" + }, "jsii-calc.jsii3656": { "locationInModule": { "filename": "lib/index.ts", @@ -16208,6 +16232,220 @@ "namespace": "composition.CompositeOperation", "symbolId": "lib/calculator:composition.CompositeOperation.CompositionStringStyle" }, + "jsii-calc.homonymousForwardReferences.bar.Consumer": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.homonymousForwardReferences.bar.Consumer", + "kind": "class", + "locationInModule": { + "filename": "lib/homonymous/bar.ts", + "line": 9 + }, + "methods": [ + { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/homonymous/bar.ts", + "line": 10 + }, + "name": "consume", + "parameters": [ + { + "name": "props", + "type": { + "fqn": "jsii-calc.homonymousForwardReferences.bar.ConsumerProps" + } + } + ], + "returns": { + "type": { + "fqn": "jsii-calc.homonymousForwardReferences.bar.Homonymous" + } + }, + "static": true + } + ], + "name": "Consumer", + "namespace": "homonymousForwardReferences.bar", + "symbolId": "lib/homonymous/bar:Consumer" + }, + "jsii-calc.homonymousForwardReferences.bar.ConsumerProps": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.homonymousForwardReferences.bar.ConsumerProps", + "kind": "interface", + "locationInModule": { + "filename": "lib/homonymous/bar.ts", + "line": 5 + }, + "name": "ConsumerProps", + "namespace": "homonymousForwardReferences.bar", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/homonymous/bar.ts", + "line": 6 + }, + "name": "homonymous", + "type": { + "fqn": "jsii-calc.homonymousForwardReferences.bar.Homonymous" + } + } + ], + "symbolId": "lib/homonymous/bar:ConsumerProps" + }, + "jsii-calc.homonymousForwardReferences.bar.Homonymous": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.homonymousForwardReferences.bar.Homonymous", + "kind": "interface", + "locationInModule": { + "filename": "lib/homonymous/bar.ts", + "line": 1 + }, + "name": "Homonymous", + "namespace": "homonymousForwardReferences.bar", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/homonymous/bar.ts", + "line": 2 + }, + "name": "numericProperty", + "type": { + "primitive": "number" + } + } + ], + "symbolId": "lib/homonymous/bar:Homonymous" + }, + "jsii-calc.homonymousForwardReferences.foo.Consumer": { + "assembly": "jsii-calc", + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.homonymousForwardReferences.foo.Consumer", + "kind": "class", + "locationInModule": { + "filename": "lib/homonymous/foo.ts", + "line": 9 + }, + "methods": [ + { + "docs": { + "stability": "stable" + }, + "locationInModule": { + "filename": "lib/homonymous/foo.ts", + "line": 10 + }, + "name": "consume", + "parameters": [ + { + "name": "props", + "type": { + "fqn": "jsii-calc.homonymousForwardReferences.foo.ConsumerProps" + } + } + ], + "returns": { + "type": { + "fqn": "jsii-calc.homonymousForwardReferences.foo.Homonymous" + } + }, + "static": true + } + ], + "name": "Consumer", + "namespace": "homonymousForwardReferences.foo", + "symbolId": "lib/homonymous/foo:Consumer" + }, + "jsii-calc.homonymousForwardReferences.foo.ConsumerProps": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.homonymousForwardReferences.foo.ConsumerProps", + "kind": "interface", + "locationInModule": { + "filename": "lib/homonymous/foo.ts", + "line": 5 + }, + "name": "ConsumerProps", + "namespace": "homonymousForwardReferences.foo", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/homonymous/foo.ts", + "line": 6 + }, + "name": "homonymous", + "type": { + "fqn": "jsii-calc.homonymousForwardReferences.foo.Homonymous" + } + } + ], + "symbolId": "lib/homonymous/foo:ConsumerProps" + }, + "jsii-calc.homonymousForwardReferences.foo.Homonymous": { + "assembly": "jsii-calc", + "datatype": true, + "docs": { + "stability": "stable" + }, + "fqn": "jsii-calc.homonymousForwardReferences.foo.Homonymous", + "kind": "interface", + "locationInModule": { + "filename": "lib/homonymous/foo.ts", + "line": 1 + }, + "name": "Homonymous", + "namespace": "homonymousForwardReferences.foo", + "properties": [ + { + "abstract": true, + "docs": { + "stability": "stable" + }, + "immutable": true, + "locationInModule": { + "filename": "lib/homonymous/foo.ts", + "line": 2 + }, + "name": "stringProperty", + "type": { + "primitive": "string" + } + } + ], + "symbolId": "lib/homonymous/foo:Homonymous" + }, "jsii-calc.jsii3656.ImplementMeOpts": { "assembly": "jsii-calc", "datatype": true, @@ -18327,5 +18565,5 @@ } }, "version": "3.20.120", - "fingerprint": "O7e7hA2s4dwiCigDIFE0ANjlmeXIQydXdSodi9WHja4=" + "fingerprint": "b2P7abkCSB3ezfp46ujoSHTYSgRV0o7O1avtvIe5xX8=" } \ No newline at end of file diff --git a/packages/jsii-pacmak/lib/targets/python.ts b/packages/jsii-pacmak/lib/targets/python.ts index ca2c84dff6..4819526019 100644 --- a/packages/jsii-pacmak/lib/targets/python.ts +++ b/packages/jsii-pacmak/lib/targets/python.ts @@ -3088,7 +3088,18 @@ function emitParameterTypeChecks( // by a decorated version with different type annotations). We also cannot construct the actual value expected by // typeguard's `check_type` because Python does not expose the APIs necessary to build many of these objects in // regular Python code. - openSignature(code, 'def', stubVar, params, 'None'); + // + // Since the nesting function will only be callable once this module is fully loaded, we can convert forward type + // references into regular references, so that the type checker is not confused by multiple type references + // sharing the same leaf type name (the ForwardRef resolution may be cached in the execution scope, which causes + // order-of-initialization problems, as can be seen in aws/jsii#3818). + openSignature( + code, + 'def', + stubVar, + params.map((param) => param.replace(/"/g, '')), + 'None', + ); code.line('...'); code.closeBlock(); diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap index 0e038f7652..54fc373157 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-dotnet.test.js.snap @@ -2990,6 +2990,20 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ πŸ“„ GiveMeStructs.cs ┃ ┣━ πŸ“„ Greetee.cs ┃ ┣━ πŸ“„ GreetingAugmenter.cs + ┃ ┣━ πŸ“ HomonymousForwardReferences + ┃ ┃ ┣━ πŸ“ Bar + ┃ ┃ ┃ ┣━ πŸ“„ Consumer.cs + ┃ ┃ ┃ ┣━ πŸ“„ ConsumerProps.cs + ┃ ┃ ┃ ┣━ πŸ“„ Homonymous.cs + ┃ ┃ ┃ ┣━ πŸ“„ IConsumerProps.cs + ┃ ┃ ┃ ┗━ πŸ“„ IHomonymous.cs + ┃ ┃ ┣━ πŸ“ Foo + ┃ ┃ ┃ ┣━ πŸ“„ Consumer.cs + ┃ ┃ ┃ ┣━ πŸ“„ ConsumerProps.cs + ┃ ┃ ┃ ┣━ πŸ“„ Homonymous.cs + ┃ ┃ ┃ ┣━ πŸ“„ IConsumerProps.cs + ┃ ┃ ┃ ┗━ πŸ“„ IHomonymous.cs + ┃ ┃ ┗━ πŸ“„ NamespaceDoc.cs ┃ ┣━ πŸ“„ IAnonymousImplementationProvider.cs ┃ ┣━ πŸ“„ IAnonymouslyImplementMe.cs ┃ ┣━ πŸ“„ IAnotherPublicInterface.cs @@ -7959,6 +7973,321 @@ namespace Amazon.JSII.Tests.CalculatorNamespace `; +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Bar/Consumer.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar +{ + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.Consumer), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.bar.Consumer")] + public class Consumer : DeputyBase + { + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference + /// The Javascript-owned object reference + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected Consumer(ByRefValue reference): base(reference) + { + } + + /// Used by jsii to construct an instance of this class from DeputyProps + /// The deputy props + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected Consumer(DeputyProps props): base(props) + { + } + + [JsiiMethod(name: "consume", returnsJson: "{\\"type\\":{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.bar.Homonymous\\"}}", parametersJson: "[{\\"name\\":\\"props\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.bar.ConsumerProps\\"}}]")] + public static Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IHomonymous Consume(Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IConsumerProps props) + { + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.Consumer), new System.Type[]{typeof(Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IConsumerProps)}, new object[]{props})!; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Bar/ConsumerProps.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar +{ + #pragma warning disable CS8618 + + [JsiiByValue(fqn: "jsii-calc.homonymousForwardReferences.bar.ConsumerProps")] + public class ConsumerProps : Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IConsumerProps + { + [JsiiProperty(name: "homonymous", typeJson: "{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.bar.Homonymous\\"}")] + public Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IHomonymous Homonymous + { + get; + set; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Bar/Homonymous.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar +{ + #pragma warning disable CS8618 + + [JsiiByValue(fqn: "jsii-calc.homonymousForwardReferences.bar.Homonymous")] + public class Homonymous : Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IHomonymous + { + [JsiiProperty(name: "numericProperty", typeJson: "{\\"primitive\\":\\"number\\"}")] + public double NumericProperty + { + get; + set; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Bar/IConsumerProps.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar +{ + [JsiiInterface(nativeType: typeof(IConsumerProps), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.bar.ConsumerProps")] + public interface IConsumerProps + { + [JsiiProperty(name: "homonymous", typeJson: "{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.bar.Homonymous\\"}")] + Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IHomonymous Homonymous + { + get; + } + + [JsiiTypeProxy(nativeType: typeof(IConsumerProps), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.bar.ConsumerProps")] + internal sealed class _Proxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IConsumerProps + { + private _Proxy(ByRefValue reference): base(reference) + { + } + + [JsiiProperty(name: "homonymous", typeJson: "{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.bar.Homonymous\\"}")] + public Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IHomonymous Homonymous + { + get => GetInstanceProperty()!; + } + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Bar/IHomonymous.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar +{ + [JsiiInterface(nativeType: typeof(IHomonymous), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.bar.Homonymous")] + public interface IHomonymous + { + [JsiiProperty(name: "numericProperty", typeJson: "{\\"primitive\\":\\"number\\"}")] + double NumericProperty + { + get; + } + + [JsiiTypeProxy(nativeType: typeof(IHomonymous), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.bar.Homonymous")] + internal sealed class _Proxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Bar.IHomonymous + { + private _Proxy(ByRefValue reference): base(reference) + { + } + + [JsiiProperty(name: "numericProperty", typeJson: "{\\"primitive\\":\\"number\\"}")] + public double NumericProperty + { + get => GetInstanceProperty()!; + } + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Foo/Consumer.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo +{ + [JsiiClass(nativeType: typeof(Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.Consumer), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.foo.Consumer")] + public class Consumer : DeputyBase + { + /// Used by jsii to construct an instance of this class from a Javascript-owned object reference + /// The Javascript-owned object reference + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected Consumer(ByRefValue reference): base(reference) + { + } + + /// Used by jsii to construct an instance of this class from DeputyProps + /// The deputy props + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + protected Consumer(DeputyProps props): base(props) + { + } + + [JsiiMethod(name: "consume", returnsJson: "{\\"type\\":{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.foo.Homonymous\\"}}", parametersJson: "[{\\"name\\":\\"props\\",\\"type\\":{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.foo.ConsumerProps\\"}}]")] + public static Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IHomonymous Consume(Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IConsumerProps props) + { + return InvokeStaticMethod(typeof(Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.Consumer), new System.Type[]{typeof(Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IConsumerProps)}, new object[]{props})!; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Foo/ConsumerProps.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo +{ + #pragma warning disable CS8618 + + [JsiiByValue(fqn: "jsii-calc.homonymousForwardReferences.foo.ConsumerProps")] + public class ConsumerProps : Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IConsumerProps + { + [JsiiProperty(name: "homonymous", typeJson: "{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.foo.Homonymous\\"}")] + public Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IHomonymous Homonymous + { + get; + set; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Foo/Homonymous.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo +{ + #pragma warning disable CS8618 + + [JsiiByValue(fqn: "jsii-calc.homonymousForwardReferences.foo.Homonymous")] + public class Homonymous : Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IHomonymous + { + [JsiiProperty(name: "stringProperty", typeJson: "{\\"primitive\\":\\"string\\"}")] + public string StringProperty + { + get; + set; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Foo/IConsumerProps.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo +{ + [JsiiInterface(nativeType: typeof(IConsumerProps), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.foo.ConsumerProps")] + public interface IConsumerProps + { + [JsiiProperty(name: "homonymous", typeJson: "{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.foo.Homonymous\\"}")] + Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IHomonymous Homonymous + { + get; + } + + [JsiiTypeProxy(nativeType: typeof(IConsumerProps), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.foo.ConsumerProps")] + internal sealed class _Proxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IConsumerProps + { + private _Proxy(ByRefValue reference): base(reference) + { + } + + [JsiiProperty(name: "homonymous", typeJson: "{\\"fqn\\":\\"jsii-calc.homonymousForwardReferences.foo.Homonymous\\"}")] + public Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IHomonymous Homonymous + { + get => GetInstanceProperty()!; + } + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/Foo/IHomonymous.cs 1`] = ` +using Amazon.JSII.Runtime.Deputy; + +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo +{ + [JsiiInterface(nativeType: typeof(IHomonymous), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.foo.Homonymous")] + public interface IHomonymous + { + [JsiiProperty(name: "stringProperty", typeJson: "{\\"primitive\\":\\"string\\"}")] + string StringProperty + { + get; + } + + [JsiiTypeProxy(nativeType: typeof(IHomonymous), fullyQualifiedName: "jsii-calc.homonymousForwardReferences.foo.Homonymous")] + internal sealed class _Proxy : DeputyBase, Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences.Foo.IHomonymous + { + private _Proxy(ByRefValue reference): base(reference) + { + } + + [JsiiProperty(name: "stringProperty", typeJson: "{\\"primitive\\":\\"string\\"}")] + public string StringProperty + { + get => GetInstanceProperty()!; + } + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/HomonymousForwardReferences/NamespaceDoc.cs 1`] = ` +#pragma warning disable CS0672,CS0809,CS1591 + +namespace Amazon.JSII.Tests.CalculatorNamespace.HomonymousForwardReferences +{ + /// + /// Verifies homonymous forward references don't trip the Python type checker + /// + /// This has been an issue when stub functions were introduced to create a reliable source for type checking + /// information, which was reported in https://github.com/aws/jsii/issues/3818. + /// + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public class NamespaceDoc + { + } +} + +`; + exports[`Generated code for "jsii-calc": /dotnet/Amazon.JSII.Tests.CalculatorPackageId/Amazon/JSII/Tests/CalculatorNamespace/IAnonymousImplementationProvider.cs 1`] = ` using Amazon.JSII.Runtime.Deputy; diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap index 091c26280c..73f801beec 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.js.snap @@ -2557,6 +2557,18 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ πŸ“„ derivedclasshasnoproperties_Derived.go ┃ ┗━ πŸ“„ derivedclasshasnoproperties.go ┣━ πŸ“„ go.mod + ┣━ πŸ“ homonymousforwardreferences + ┃ ┣━ πŸ“ bar + ┃ ┃ ┣━ πŸ“„ bar_Consumer.go + ┃ ┃ ┣━ πŸ“„ bar_ConsumerProps.go + ┃ ┃ ┣━ πŸ“„ bar_Homonymous.go + ┃ ┃ ┗━ πŸ“„ bar.go + ┃ ┣━ πŸ“ foo + ┃ ┃ ┣━ πŸ“„ foo_Consumer.go + ┃ ┃ ┣━ πŸ“„ foo_ConsumerProps.go + ┃ ┃ ┣━ πŸ“„ foo_Homonymous.go + ┃ ┃ ┗━ πŸ“„ foo.go + ┃ ┗━ πŸ“„ README.md ┣━ πŸ“ interfaceinnamespaceincludesclasses ┃ ┣━ πŸ“„ interfaceinnamespaceincludesclasses_Foo.go ┃ ┣━ πŸ“„ interfaceinnamespaceincludesclasses_Hello.go @@ -3904,6 +3916,186 @@ require ( github.com/aws/jsii/jsii-calc/go/scopejsiicalcbaseofbase/v2 v2.1.1 // indirect ) +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/README.md 1`] = ` +Verifies homonymous forward references don't trip the Python type checker + +This has been an issue when stub functions were introduced to create a reliable source for type checking +information, which was reported in https://github.com/aws/jsii/issues/3818. + +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/bar/bar.go 1`] = ` +package bar + +import ( + "reflect" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" +) + +func init() { + _jsii_.RegisterClass( + "jsii-calc.homonymousForwardReferences.bar.Consumer", + reflect.TypeOf((*Consumer)(nil)).Elem(), + nil, // no members + func() interface{} { + return &jsiiProxy_Consumer{} + }, + ) + _jsii_.RegisterStruct( + "jsii-calc.homonymousForwardReferences.bar.ConsumerProps", + reflect.TypeOf((*ConsumerProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "jsii-calc.homonymousForwardReferences.bar.Homonymous", + reflect.TypeOf((*Homonymous)(nil)).Elem(), + ) +} + +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer.go 1`] = ` +package bar + +import ( + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + _init_ "github.com/aws/jsii/jsii-calc/go/jsiicalc/v3/jsii" +) + +type Consumer interface { +} + +// The jsii proxy struct for Consumer +type jsiiProxy_Consumer struct { + _ byte // padding +} + +func Consumer_Consume(props *ConsumerProps) *Homonymous { + _init_.Initialize() + + var returns *Homonymous + + _jsii_.StaticInvoke( + "jsii-calc.homonymousForwardReferences.bar.Consumer", + "consume", + []interface{}{props}, + &returns, + ) + + return returns +} + + +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/bar/bar_ConsumerProps.go 1`] = ` +package bar + + +type ConsumerProps struct { + Homonymous *Homonymous \`field:"required" json:"homonymous" yaml:"homonymous"\` +} + + +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/bar/bar_Homonymous.go 1`] = ` +package bar + + +type Homonymous struct { + NumericProperty *float64 \`field:"required" json:"numericProperty" yaml:"numericProperty"\` +} + + +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/foo/foo.go 1`] = ` +package foo + +import ( + "reflect" + + _jsii_ "github.com/aws/jsii-runtime-go/runtime" +) + +func init() { + _jsii_.RegisterClass( + "jsii-calc.homonymousForwardReferences.foo.Consumer", + reflect.TypeOf((*Consumer)(nil)).Elem(), + nil, // no members + func() interface{} { + return &jsiiProxy_Consumer{} + }, + ) + _jsii_.RegisterStruct( + "jsii-calc.homonymousForwardReferences.foo.ConsumerProps", + reflect.TypeOf((*ConsumerProps)(nil)).Elem(), + ) + _jsii_.RegisterStruct( + "jsii-calc.homonymousForwardReferences.foo.Homonymous", + reflect.TypeOf((*Homonymous)(nil)).Elem(), + ) +} + +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer.go 1`] = ` +package foo + +import ( + _jsii_ "github.com/aws/jsii-runtime-go/runtime" + _init_ "github.com/aws/jsii/jsii-calc/go/jsiicalc/v3/jsii" +) + +type Consumer interface { +} + +// The jsii proxy struct for Consumer +type jsiiProxy_Consumer struct { + _ byte // padding +} + +func Consumer_Consume(props *ConsumerProps) *Homonymous { + _init_.Initialize() + + var returns *Homonymous + + _jsii_.StaticInvoke( + "jsii-calc.homonymousForwardReferences.foo.Consumer", + "consume", + []interface{}{props}, + &returns, + ) + + return returns +} + + +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/foo/foo_ConsumerProps.go 1`] = ` +package foo + + +type ConsumerProps struct { + Homonymous *Homonymous \`field:"required" json:"homonymous" yaml:"homonymous"\` +} + + +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/foo/foo_Homonymous.go 1`] = ` +package foo + + +type Homonymous struct { + StringProperty *string \`field:"required" json:"stringProperty" yaml:"stringProperty"\` +} + + `; exports[`Generated code for "jsii-calc": /go/jsiicalc/interfaceinnamespaceincludesclasses/interfaceinnamespaceincludesclasses.go 1`] = ` @@ -24429,6 +24621,15 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ πŸ†• derivedclasshasnoproperties_Derived__no_runtime_type_checking.go ┃ ┣━ πŸ†• derivedclasshasnoproperties_Derived__runtime_type_checks.go ┃ ┗━ πŸ“„ derivedclasshasnoproperties_Derived.go.diff + ┣━ πŸ“ homonymousforwardreferences + ┃ ┣━ πŸ“ bar + ┃ ┃ ┣━ πŸ†• bar_Consumer__no_runtime_type_checking.go + ┃ ┃ ┣━ πŸ†• bar_Consumer__runtime_type_checks.go + ┃ ┃ ┗━ πŸ“„ bar_Consumer.go.diff + ┃ ┗━ πŸ“ foo + ┃ ┣━ πŸ†• foo_Consumer__no_runtime_type_checking.go + ┃ ┣━ πŸ†• foo_Consumer__runtime_type_checks.go + ┃ ┗━ πŸ“„ foo_Consumer.go.diff ┣━ πŸ“ jsii3656 ┃ ┣━ πŸ†• jsii3656_OverrideMe__no_runtime_type_checking.go ┃ ┣━ πŸ†• jsii3656_OverrideMe__runtime_type_checks.go @@ -25198,6 +25399,130 @@ exports[`Generated code for "jsii-calc": /go/jsiicalc/d + `; +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer.go.diff 1`] = ` +--- go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer.go --no-runtime-type-checking ++++ go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer.go --runtime-type-checking +@@ -14,10 +14,13 @@ + } + + func Consumer_Consume(props *ConsumerProps) *Homonymous { + _init_.Initialize() + ++ if err := validateConsumer_ConsumeParameters(props); err != nil { ++ panic(err) ++ } + var returns *Homonymous + + _jsii_.StaticInvoke( + "jsii-calc.homonymousForwardReferences.bar.Consumer", + "consume", +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer__no_runtime_type_checking.go.diff 1`] = ` +--- go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer__no_runtime_type_checking.go --no-runtime-type-checking ++++ go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer__no_runtime_type_checking.go --runtime-type-checking +@@ -0,0 +1,10 @@ ++//go:build no_runtime_type_checking ++ ++package bar ++ ++// Building without runtime type checking enabled, so all the below just return nil ++ ++func validateConsumer_ConsumeParameters(props *ConsumerProps) error { ++ return nil ++} ++ +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer__runtime_type_checks.go.diff 1`] = ` +--- go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer__runtime_type_checks.go --no-runtime-type-checking ++++ go/jsiicalc/homonymousforwardreferences/bar/bar_Consumer__runtime_type_checks.go --runtime-type-checking +@@ -0,0 +1,21 @@ ++//go:build !no_runtime_type_checking ++ ++package bar ++ ++import ( ++ "fmt" ++ ++ _jsii_ "github.com/aws/jsii-runtime-go/runtime" ++) ++ ++func validateConsumer_ConsumeParameters(props *ConsumerProps) error { ++ if props == nil { ++ return fmt.Errorf("parameter props is required, but nil was provided") ++ } ++ if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { ++ return err ++ } ++ ++ return nil ++} ++ +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer.go.diff 1`] = ` +--- go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer.go --no-runtime-type-checking ++++ go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer.go --runtime-type-checking +@@ -14,10 +14,13 @@ + } + + func Consumer_Consume(props *ConsumerProps) *Homonymous { + _init_.Initialize() + ++ if err := validateConsumer_ConsumeParameters(props); err != nil { ++ panic(err) ++ } + var returns *Homonymous + + _jsii_.StaticInvoke( + "jsii-calc.homonymousForwardReferences.foo.Consumer", + "consume", +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer__no_runtime_type_checking.go.diff 1`] = ` +--- go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer__no_runtime_type_checking.go --no-runtime-type-checking ++++ go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer__no_runtime_type_checking.go --runtime-type-checking +@@ -0,0 +1,10 @@ ++//go:build no_runtime_type_checking ++ ++package foo ++ ++// Building without runtime type checking enabled, so all the below just return nil ++ ++func validateConsumer_ConsumeParameters(props *ConsumerProps) error { ++ return nil ++} ++ +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer__runtime_type_checks.go.diff 1`] = ` +--- go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer__runtime_type_checks.go --no-runtime-type-checking ++++ go/jsiicalc/homonymousforwardreferences/foo/foo_Consumer__runtime_type_checks.go --runtime-type-checking +@@ -0,0 +1,21 @@ ++//go:build !no_runtime_type_checking ++ ++package foo ++ ++import ( ++ "fmt" ++ ++ _jsii_ "github.com/aws/jsii-runtime-go/runtime" ++) ++ ++func validateConsumer_ConsumeParameters(props *ConsumerProps) error { ++ if props == nil { ++ return fmt.Errorf("parameter props is required, but nil was provided") ++ } ++ if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil { ++ return err ++ } ++ ++ return nil ++} ++ +`; + exports[`Generated code for "jsii-calc": /go/jsiicalc/jsii3656/jsii3656_OverrideMe.go.diff 1`] = ` --- go/jsiicalc/jsii3656/jsii3656_OverrideMe.go --no-runtime-type-checking +++ go/jsiicalc/jsii3656/jsii3656_OverrideMe.go --runtime-type-checking diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap index 43dda414da..6d66337ce0 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap @@ -3774,6 +3774,16 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┣━ πŸ“„ GiveMeStructs.java ┃ ┣━ πŸ“„ Greetee.java ┃ ┣━ πŸ“„ GreetingAugmenter.java + ┃ ┣━ πŸ“ homonymous_forward_references + ┃ ┃ ┣━ πŸ“ bar + ┃ ┃ ┃ ┣━ πŸ“„ Consumer.java + ┃ ┃ ┃ ┣━ πŸ“„ ConsumerProps.java + ┃ ┃ ┃ ┗━ πŸ“„ Homonymous.java + ┃ ┃ ┣━ πŸ“ foo + ┃ ┃ ┃ ┣━ πŸ“„ Consumer.java + ┃ ┃ ┃ ┣━ πŸ“„ ConsumerProps.java + ┃ ┃ ┃ ┗━ πŸ“„ Homonymous.java + ┃ ┃ ┗━ πŸ“„ package-info.java ┃ ┣━ πŸ“„ IAnonymousImplementationProvider.java ┃ ┣━ πŸ“„ IAnonymouslyImplementMe.java ┃ ┣━ πŸ“„ IAnotherPublicInterface.java @@ -23932,6 +23942,559 @@ public class Derived extends software.amazon.jsii.tests.calculator.derived_class `; +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/homonymous_forward_references/bar/Consumer.java 1`] = ` +package software.amazon.jsii.tests.calculator.homonymous_forward_references.bar; + +/** + */ +@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.homonymousForwardReferences.bar.Consumer") +public class Consumer extends software.amazon.jsii.JsiiObject { + + protected Consumer(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + } + + protected Consumer(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { + super(initializationMode); + } + + /** + * @param props This parameter is required. + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public static @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Homonymous consume(final @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.ConsumerProps props) { + return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Consumer.class, "consume", software.amazon.jsii.NativeType.forClass(software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Homonymous.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") }); + } +} + +`; + +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/homonymous_forward_references/bar/ConsumerProps.java 1`] = ` +package software.amazon.jsii.tests.calculator.homonymous_forward_references.bar; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.homonymousForwardReferences.bar.ConsumerProps") +@software.amazon.jsii.Jsii.Proxy(ConsumerProps.Jsii$Proxy.class) +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +public interface ConsumerProps extends software.amazon.jsii.JsiiSerializable { + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Homonymous getHomonymous(); + + /** + * @return a {@link Builder} of {@link ConsumerProps} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + static Builder builder() { + return new Builder(); + } + /** + * A builder for {@link ConsumerProps} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public static final class Builder implements software.amazon.jsii.Builder { + software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Homonymous homonymous; + + /** + * Sets the value of {@link ConsumerProps#getHomonymous} + * @param homonymous the value to be set. This parameter is required. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public Builder homonymous(software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Homonymous homonymous) { + this.homonymous = homonymous; + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link ConsumerProps} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @Override + public ConsumerProps build() { + return new Jsii$Proxy(this); + } + } + + /** + * An implementation for {@link ConsumerProps} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @software.amazon.jsii.Internal + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ConsumerProps { + private final software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Homonymous homonymous; + + /** + * Constructor that initializes the object based on values retrieved from the JsiiObject. + * @param objRef Reference to the JSII managed object. + */ + protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + this.homonymous = software.amazon.jsii.Kernel.get(this, "homonymous", software.amazon.jsii.NativeType.forClass(software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Homonymous.class)); + } + + /** + * Constructor that initializes the object based on literal property values passed by the {@link Builder}. + */ + protected Jsii$Proxy(final Builder builder) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + this.homonymous = java.util.Objects.requireNonNull(builder.homonymous, "homonymous is required"); + } + + @Override + public final software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Homonymous getHomonymous() { + return this.homonymous; + } + + @Override + @software.amazon.jsii.Internal + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + + data.set("homonymous", om.valueToTree(this.getHomonymous())); + + final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + struct.set("fqn", om.valueToTree("jsii-calc.homonymousForwardReferences.bar.ConsumerProps")); + struct.set("data", data); + + final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("$jsii.struct", struct); + + return obj; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ConsumerProps.Jsii$Proxy that = (ConsumerProps.Jsii$Proxy) o; + + return this.homonymous.equals(that.homonymous); + } + + @Override + public final int hashCode() { + int result = this.homonymous.hashCode(); + return result; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/homonymous_forward_references/bar/Homonymous.java 1`] = ` +package software.amazon.jsii.tests.calculator.homonymous_forward_references.bar; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.homonymousForwardReferences.bar.Homonymous") +@software.amazon.jsii.Jsii.Proxy(Homonymous.Jsii$Proxy.class) +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +public interface Homonymous extends software.amazon.jsii.JsiiSerializable { + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @org.jetbrains.annotations.NotNull java.lang.Number getNumericProperty(); + + /** + * @return a {@link Builder} of {@link Homonymous} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + static Builder builder() { + return new Builder(); + } + /** + * A builder for {@link Homonymous} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public static final class Builder implements software.amazon.jsii.Builder { + java.lang.Number numericProperty; + + /** + * Sets the value of {@link Homonymous#getNumericProperty} + * @param numericProperty the value to be set. This parameter is required. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public Builder numericProperty(java.lang.Number numericProperty) { + this.numericProperty = numericProperty; + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link Homonymous} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @Override + public Homonymous build() { + return new Jsii$Proxy(this); + } + } + + /** + * An implementation for {@link Homonymous} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @software.amazon.jsii.Internal + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Homonymous { + private final java.lang.Number numericProperty; + + /** + * Constructor that initializes the object based on values retrieved from the JsiiObject. + * @param objRef Reference to the JSII managed object. + */ + protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + this.numericProperty = software.amazon.jsii.Kernel.get(this, "numericProperty", software.amazon.jsii.NativeType.forClass(java.lang.Number.class)); + } + + /** + * Constructor that initializes the object based on literal property values passed by the {@link Builder}. + */ + protected Jsii$Proxy(final Builder builder) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + this.numericProperty = java.util.Objects.requireNonNull(builder.numericProperty, "numericProperty is required"); + } + + @Override + public final java.lang.Number getNumericProperty() { + return this.numericProperty; + } + + @Override + @software.amazon.jsii.Internal + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + + data.set("numericProperty", om.valueToTree(this.getNumericProperty())); + + final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + struct.set("fqn", om.valueToTree("jsii-calc.homonymousForwardReferences.bar.Homonymous")); + struct.set("data", data); + + final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("$jsii.struct", struct); + + return obj; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Homonymous.Jsii$Proxy that = (Homonymous.Jsii$Proxy) o; + + return this.numericProperty.equals(that.numericProperty); + } + + @Override + public final int hashCode() { + int result = this.numericProperty.hashCode(); + return result; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/homonymous_forward_references/foo/Consumer.java 1`] = ` +package software.amazon.jsii.tests.calculator.homonymous_forward_references.foo; + +/** + */ +@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.homonymousForwardReferences.foo.Consumer") +public class Consumer extends software.amazon.jsii.JsiiObject { + + protected Consumer(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + } + + protected Consumer(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { + super(initializationMode); + } + + /** + * @param props This parameter is required. + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public static @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Homonymous consume(final @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.ConsumerProps props) { + return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Consumer.class, "consume", software.amazon.jsii.NativeType.forClass(software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Homonymous.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") }); + } +} + +`; + +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/homonymous_forward_references/foo/ConsumerProps.java 1`] = ` +package software.amazon.jsii.tests.calculator.homonymous_forward_references.foo; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.homonymousForwardReferences.foo.ConsumerProps") +@software.amazon.jsii.Jsii.Proxy(ConsumerProps.Jsii$Proxy.class) +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +public interface ConsumerProps extends software.amazon.jsii.JsiiSerializable { + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @org.jetbrains.annotations.NotNull software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Homonymous getHomonymous(); + + /** + * @return a {@link Builder} of {@link ConsumerProps} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + static Builder builder() { + return new Builder(); + } + /** + * A builder for {@link ConsumerProps} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public static final class Builder implements software.amazon.jsii.Builder { + software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Homonymous homonymous; + + /** + * Sets the value of {@link ConsumerProps#getHomonymous} + * @param homonymous the value to be set. This parameter is required. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public Builder homonymous(software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Homonymous homonymous) { + this.homonymous = homonymous; + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link ConsumerProps} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @Override + public ConsumerProps build() { + return new Jsii$Proxy(this); + } + } + + /** + * An implementation for {@link ConsumerProps} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @software.amazon.jsii.Internal + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ConsumerProps { + private final software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Homonymous homonymous; + + /** + * Constructor that initializes the object based on values retrieved from the JsiiObject. + * @param objRef Reference to the JSII managed object. + */ + protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + this.homonymous = software.amazon.jsii.Kernel.get(this, "homonymous", software.amazon.jsii.NativeType.forClass(software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Homonymous.class)); + } + + /** + * Constructor that initializes the object based on literal property values passed by the {@link Builder}. + */ + protected Jsii$Proxy(final Builder builder) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + this.homonymous = java.util.Objects.requireNonNull(builder.homonymous, "homonymous is required"); + } + + @Override + public final software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Homonymous getHomonymous() { + return this.homonymous; + } + + @Override + @software.amazon.jsii.Internal + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + + data.set("homonymous", om.valueToTree(this.getHomonymous())); + + final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + struct.set("fqn", om.valueToTree("jsii-calc.homonymousForwardReferences.foo.ConsumerProps")); + struct.set("data", data); + + final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("$jsii.struct", struct); + + return obj; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + ConsumerProps.Jsii$Proxy that = (ConsumerProps.Jsii$Proxy) o; + + return this.homonymous.equals(that.homonymous); + } + + @Override + public final int hashCode() { + int result = this.homonymous.hashCode(); + return result; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/homonymous_forward_references/foo/Homonymous.java 1`] = ` +package software.amazon.jsii.tests.calculator.homonymous_forward_references.foo; + +/** + */ +@javax.annotation.Generated(value = "jsii-pacmak") +@software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.homonymousForwardReferences.foo.Homonymous") +@software.amazon.jsii.Jsii.Proxy(Homonymous.Jsii$Proxy.class) +@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) +public interface Homonymous extends software.amazon.jsii.JsiiSerializable { + + /** + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @org.jetbrains.annotations.NotNull java.lang.String getStringProperty(); + + /** + * @return a {@link Builder} of {@link Homonymous} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + static Builder builder() { + return new Builder(); + } + /** + * A builder for {@link Homonymous} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public static final class Builder implements software.amazon.jsii.Builder { + java.lang.String stringProperty; + + /** + * Sets the value of {@link Homonymous#getStringProperty} + * @param stringProperty the value to be set. This parameter is required. + * @return {@code this} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + public Builder stringProperty(java.lang.String stringProperty) { + this.stringProperty = stringProperty; + return this; + } + + /** + * Builds the configured instance. + * @return a new instance of {@link Homonymous} + * @throws NullPointerException if any required attribute was not provided + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @Override + public Homonymous build() { + return new Jsii$Proxy(this); + } + } + + /** + * An implementation for {@link Homonymous} + */ + @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) + @software.amazon.jsii.Internal + final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements Homonymous { + private final java.lang.String stringProperty; + + /** + * Constructor that initializes the object based on values retrieved from the JsiiObject. + * @param objRef Reference to the JSII managed object. + */ + protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { + super(objRef); + this.stringProperty = software.amazon.jsii.Kernel.get(this, "stringProperty", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); + } + + /** + * Constructor that initializes the object based on literal property values passed by the {@link Builder}. + */ + protected Jsii$Proxy(final Builder builder) { + super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); + this.stringProperty = java.util.Objects.requireNonNull(builder.stringProperty, "stringProperty is required"); + } + + @Override + public final java.lang.String getStringProperty() { + return this.stringProperty; + } + + @Override + @software.amazon.jsii.Internal + public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { + final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; + final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + + data.set("stringProperty", om.valueToTree(this.getStringProperty())); + + final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + struct.set("fqn", om.valueToTree("jsii-calc.homonymousForwardReferences.foo.Homonymous")); + struct.set("data", data); + + final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); + obj.set("$jsii.struct", struct); + + return obj; + } + + @Override + public final boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Homonymous.Jsii$Proxy that = (Homonymous.Jsii$Proxy) o; + + return this.stringProperty.equals(that.stringProperty); + } + + @Override + public final int hashCode() { + int result = this.stringProperty.hashCode(); + return result; + } + } +} + +`; + +exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/homonymous_forward_references/package-info.java 1`] = ` +/** + * Verifies homonymous forward references don't trip the Python type checker + *

+ * This has been an issue when stub functions were introduced to create a reliable source for type checking + * information, which was reported in https://github.com/aws/jsii/issues/3818. + */ +package software.amazon.jsii.tests.calculator.homonymous_forward_references; + +`; + exports[`Generated code for "jsii-calc": /java/src/main/java/software/amazon/jsii/tests/calculator/interface_in_namespace_includes_classes/Foo.java 1`] = ` package software.amazon.jsii.tests.calculator.interface_in_namespace_includes_classes; @@ -28029,6 +28592,12 @@ jsii-calc.cdk16625.Cdk16625=software.amazon.jsii.tests.calculator.cdk16625.Cdk16 jsii-calc.cdk16625.donotimport.UnimportedSubmoduleType=software.amazon.jsii.tests.calculator.cdk16625.donotimport.UnimportedSubmoduleType 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.homonymousForwardReferences.bar.Consumer=software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Consumer +jsii-calc.homonymousForwardReferences.bar.ConsumerProps=software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.ConsumerProps +jsii-calc.homonymousForwardReferences.bar.Homonymous=software.amazon.jsii.tests.calculator.homonymous_forward_references.bar.Homonymous +jsii-calc.homonymousForwardReferences.foo.Consumer=software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Consumer +jsii-calc.homonymousForwardReferences.foo.ConsumerProps=software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.ConsumerProps +jsii-calc.homonymousForwardReferences.foo.Homonymous=software.amazon.jsii.tests.calculator.homonymous_forward_references.foo.Homonymous jsii-calc.jsii3656.ImplementMeOpts=software.amazon.jsii.tests.calculator.jsii3656.ImplementMeOpts jsii-calc.jsii3656.OverrideMe=software.amazon.jsii.tests.calculator.jsii3656.OverrideMe jsii-calc.module2530.MyClass=software.amazon.jsii.tests.calculator.module2530.MyClass diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap index 84ade8ffdd..a7c78a478e 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-python.test.js.snap @@ -2523,6 +2523,12 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┗━ πŸ“„ __init__.py ┣━ πŸ“ derived_class_has_no_properties ┃ ┗━ πŸ“„ __init__.py + ┣━ πŸ“ homonymous_forward_references + ┃ ┣━ πŸ“„ __init__.py + ┃ ┣━ πŸ“ bar + ┃ ┃ ┗━ πŸ“„ __init__.py + ┃ ┗━ πŸ“ foo + ┃ ┗━ πŸ“„ __init__.py ┣━ πŸ“ interface_in_namespace_includes_classes ┃ ┗━ πŸ“„ __init__.py ┣━ πŸ“ interface_in_namespace_only_interface @@ -2874,6 +2880,9 @@ kwargs = json.loads( "jsii_calc.cdk16625.donotimport", "jsii_calc.composition", "jsii_calc.derived_class_has_no_properties", + "jsii_calc.homonymous_forward_references", + "jsii_calc.homonymous_forward_references.bar", + "jsii_calc.homonymous_forward_references.foo", "jsii_calc.interface_in_namespace_includes_classes", "jsii_calc.interface_in_namespace_only_interface", "jsii_calc.jsii3656", @@ -11267,6 +11276,7 @@ __all__ = [ "cdk16625", "composition", "derived_class_has_no_properties", + "homonymous_forward_references", "interface_in_namespace_includes_classes", "interface_in_namespace_only_interface", "jsii3656", @@ -11291,6 +11301,7 @@ from . import anonymous from . import cdk16625 from . import composition from . import derived_class_has_no_properties +from . import homonymous_forward_references from . import interface_in_namespace_includes_classes from . import interface_in_namespace_only_interface from . import jsii3656 @@ -11729,6 +11740,270 @@ publication.publish() `; +exports[`Generated code for "jsii-calc": /python/src/jsii_calc/homonymous_forward_references/__init__.py 1`] = ` +''' +Verifies homonymous forward references don't trip the Python type checker + +This has been an issue when stub functions were introduced to create a reliable source for type checking +information, which was reported in https://github.com/aws/jsii/issues/3818. +''' +import abc +import builtins +import datetime +import enum +import typing + +import jsii +import publication +import typing_extensions + +from typeguard import check_type + +from .._jsii import * + +__all__ = [ + "bar", + "foo", +] + +publication.publish() + +# Loading modules to ensure their types are registered with the jsii runtime library +from . import bar +from . import foo + +`; + +exports[`Generated code for "jsii-calc": /python/src/jsii_calc/homonymous_forward_references/bar/__init__.py 1`] = ` +import abc +import builtins +import datetime +import enum +import typing + +import jsii +import publication +import typing_extensions + +from typeguard import check_type + +from ..._jsii import * + + +class Consumer( + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.homonymousForwardReferences.bar.Consumer", +): + @jsii.member(jsii_name="consume") + @builtins.classmethod + def consume( + cls, + *, + homonymous: typing.Union["Homonymous", typing.Dict[str, typing.Any]], + ) -> "Homonymous": + ''' + :param homonymous: + ''' + props = ConsumerProps(homonymous=homonymous) + + return typing.cast("Homonymous", jsii.sinvoke(cls, "consume", [props])) + + +@jsii.data_type( + jsii_type="jsii-calc.homonymousForwardReferences.bar.ConsumerProps", + jsii_struct_bases=[], + name_mapping={"homonymous": "homonymous"}, +) +class ConsumerProps: + def __init__( + self, + *, + homonymous: typing.Union["Homonymous", typing.Dict[str, typing.Any]], + ) -> None: + ''' + :param homonymous: + ''' + if isinstance(homonymous, dict): + homonymous = Homonymous(**homonymous) + self._values: typing.Dict[str, typing.Any] = { + "homonymous": homonymous, + } + + @builtins.property + def homonymous(self) -> "Homonymous": + result = self._values.get("homonymous") + assert result is not None, "Required property 'homonymous' is missing" + return typing.cast("Homonymous", result) + + def __eq__(self, rhs: typing.Any) -> builtins.bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs: typing.Any) -> builtins.bool: + return not (rhs == self) + + def __repr__(self) -> str: + return "ConsumerProps(%s)" % ", ".join( + k + "=" + repr(v) for k, v in self._values.items() + ) + + +@jsii.data_type( + jsii_type="jsii-calc.homonymousForwardReferences.bar.Homonymous", + jsii_struct_bases=[], + name_mapping={"numeric_property": "numericProperty"}, +) +class Homonymous: + def __init__(self, *, numeric_property: jsii.Number) -> None: + ''' + :param numeric_property: + ''' + self._values: typing.Dict[str, typing.Any] = { + "numeric_property": numeric_property, + } + + @builtins.property + def numeric_property(self) -> jsii.Number: + result = self._values.get("numeric_property") + assert result is not None, "Required property 'numeric_property' is missing" + return typing.cast(jsii.Number, result) + + def __eq__(self, rhs: typing.Any) -> builtins.bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs: typing.Any) -> builtins.bool: + return not (rhs == self) + + def __repr__(self) -> str: + return "Homonymous(%s)" % ", ".join( + k + "=" + repr(v) for k, v in self._values.items() + ) + + +__all__ = [ + "Consumer", + "ConsumerProps", + "Homonymous", +] + +publication.publish() + +`; + +exports[`Generated code for "jsii-calc": /python/src/jsii_calc/homonymous_forward_references/foo/__init__.py 1`] = ` +import abc +import builtins +import datetime +import enum +import typing + +import jsii +import publication +import typing_extensions + +from typeguard import check_type + +from ..._jsii import * + + +class Consumer( + metaclass=jsii.JSIIMeta, + jsii_type="jsii-calc.homonymousForwardReferences.foo.Consumer", +): + @jsii.member(jsii_name="consume") + @builtins.classmethod + def consume( + cls, + *, + homonymous: typing.Union["Homonymous", typing.Dict[str, typing.Any]], + ) -> "Homonymous": + ''' + :param homonymous: + ''' + props = ConsumerProps(homonymous=homonymous) + + return typing.cast("Homonymous", jsii.sinvoke(cls, "consume", [props])) + + +@jsii.data_type( + jsii_type="jsii-calc.homonymousForwardReferences.foo.ConsumerProps", + jsii_struct_bases=[], + name_mapping={"homonymous": "homonymous"}, +) +class ConsumerProps: + def __init__( + self, + *, + homonymous: typing.Union["Homonymous", typing.Dict[str, typing.Any]], + ) -> None: + ''' + :param homonymous: + ''' + if isinstance(homonymous, dict): + homonymous = Homonymous(**homonymous) + self._values: typing.Dict[str, typing.Any] = { + "homonymous": homonymous, + } + + @builtins.property + def homonymous(self) -> "Homonymous": + result = self._values.get("homonymous") + assert result is not None, "Required property 'homonymous' is missing" + return typing.cast("Homonymous", result) + + def __eq__(self, rhs: typing.Any) -> builtins.bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs: typing.Any) -> builtins.bool: + return not (rhs == self) + + def __repr__(self) -> str: + return "ConsumerProps(%s)" % ", ".join( + k + "=" + repr(v) for k, v in self._values.items() + ) + + +@jsii.data_type( + jsii_type="jsii-calc.homonymousForwardReferences.foo.Homonymous", + jsii_struct_bases=[], + name_mapping={"string_property": "stringProperty"}, +) +class Homonymous: + def __init__(self, *, string_property: builtins.str) -> None: + ''' + :param string_property: + ''' + self._values: typing.Dict[str, typing.Any] = { + "string_property": string_property, + } + + @builtins.property + def string_property(self) -> builtins.str: + result = self._values.get("string_property") + assert result is not None, "Required property 'string_property' is missing" + return typing.cast(builtins.str, result) + + def __eq__(self, rhs: typing.Any) -> builtins.bool: + return isinstance(rhs, self.__class__) and rhs._values == self._values + + def __ne__(self, rhs: typing.Any) -> builtins.bool: + return not (rhs == self) + + def __repr__(self) -> str: + return "Homonymous(%s)" % ", ".join( + k + "=" + repr(v) for k, v in self._values.items() + ) + + +__all__ = [ + "Consumer", + "ConsumerProps", + "Homonymous", +] + +publication.publish() + +`; + exports[`Generated code for "jsii-calc": /python/src/jsii_calc/interface_in_namespace_includes_classes/__init__.py 1`] = ` import abc import builtins @@ -13859,6 +14134,11 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┃ ┗━ πŸ“„ __init__.py.diff ┣━ πŸ“ derived_class_has_no_properties ┃ ┗━ πŸ“„ __init__.py.diff + ┣━ πŸ“ homonymous_forward_references + ┃ ┣━ πŸ“ bar + ┃ ┃ ┗━ πŸ“„ __init__.py.diff + ┃ ┗━ πŸ“ foo + ┃ ┗━ πŸ“„ __init__.py.diff ┣━ πŸ“ interface_in_namespace_includes_classes ┃ ┗━ πŸ“„ __init__.py.diff ┣━ πŸ“ interface_in_namespace_only_interface @@ -13965,7 +14245,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param value: - ''' + if __debug__: -+ def stub(value: "StringEnum") -> None: ++ def stub(value: StringEnum) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument value", value=value, expected_type=type_hints["value"]) @@ -14065,7 +14345,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @enum_property.setter def enum_property(self, value: "AllTypesEnum") -> None: + if __debug__: -+ def stub(value: "AllTypesEnum") -> None: ++ def stub(value: AllTypesEnum) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument value", value=value, expected_type=type_hints["value"]) @@ -14178,7 +14458,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ) -> None: + if __debug__: + def stub( -+ value: typing.Union[builtins.str, jsii.Number, scope.jsii_calc_lib.Number, "Multiply"], ++ value: typing.Union[builtins.str, jsii.Number, scope.jsii_calc_lib.Number, Multiply], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -14237,7 +14517,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @optional_enum_value.setter def optional_enum_value(self, value: typing.Optional["StringEnum"]) -> None: + if __debug__: -+ def stub(value: typing.Optional["StringEnum"]) -> None: ++ def stub(value: typing.Optional[StringEnum]) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument value", value=value, expected_type=type_hints["value"]) @@ -14315,7 +14595,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ''' + if __debug__: + def stub( -+ scope_: "Bell", ++ scope_: Bell, + *, + scope: builtins.str, + props: typing.Optional[builtins.bool] = None, @@ -14464,7 +14744,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ) -> None: + if __debug__: + def stub( -+ value: typing.Optional[typing.Union["Add", "Multiply", "Power"]], ++ value: typing.Optional[typing.Union[Add, Multiply, Power]], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -14503,7 +14783,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ''' + if __debug__: + def stub( -+ union_property: typing.Sequence[typing.Mapping[builtins.str, typing.Union[typing.Union["StructA", typing.Dict[str, typing.Any]], typing.Union["StructB", typing.Dict[str, typing.Any]]]]], ++ union_property: typing.Sequence[typing.Mapping[builtins.str, typing.Union[typing.Union[StructA, typing.Dict[str, typing.Any]], typing.Union[StructB, typing.Dict[str, typing.Any]]]]], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -14521,7 +14801,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ) -> None: + if __debug__: + def stub( -+ value: typing.List[typing.Mapping[builtins.str, typing.Union["StructA", "StructB"]]], ++ value: typing.List[typing.Mapping[builtins.str, typing.Union[StructA, StructB]]], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -14617,13 +14897,13 @@ exports[`Generated code for "jsii-calc": /python/src/js ''' + if __debug__: + def stub( -+ array: typing.Sequence[typing.Union["DummyObj", typing.Dict[str, typing.Any]]], -+ record: typing.Mapping[builtins.str, typing.Union["DummyObj", typing.Dict[str, typing.Any]]], -+ obj: typing.Mapping[builtins.str, typing.Union["DummyObj", typing.Dict[str, typing.Any]]], ++ array: typing.Sequence[typing.Union[DummyObj, typing.Dict[str, typing.Any]]], ++ record: typing.Mapping[builtins.str, typing.Union[DummyObj, typing.Dict[str, typing.Any]]], ++ obj: typing.Mapping[builtins.str, typing.Union[DummyObj, typing.Dict[str, typing.Any]]], + *, -+ array_prop: typing.Sequence[typing.Union["DummyObj", typing.Dict[str, typing.Any]]], -+ obj_prop: typing.Mapping[builtins.str, typing.Union["DummyObj", typing.Dict[str, typing.Any]]], -+ record_prop: typing.Mapping[builtins.str, typing.Union["DummyObj", typing.Dict[str, typing.Any]]], ++ array_prop: typing.Sequence[typing.Union[DummyObj, typing.Dict[str, typing.Any]]], ++ obj_prop: typing.Mapping[builtins.str, typing.Union[DummyObj, typing.Dict[str, typing.Any]]], ++ record_prop: typing.Mapping[builtins.str, typing.Union[DummyObj, typing.Dict[str, typing.Any]]], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -14670,7 +14950,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @mutable_object.setter def mutable_object(self, value: "IMutableObjectLiteral") -> None: + if __debug__: -+ def stub(value: "IMutableObjectLiteral") -> None: ++ def stub(value: IMutableObjectLiteral) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument value", value=value, expected_type=type_hints["value"]) @@ -14687,7 +14967,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ''' + if __debug__: + def stub( -+ union_property: typing.Sequence[typing.Union[typing.Mapping[builtins.str, typing.Union[typing.Union["StructA", typing.Dict[str, typing.Any]], typing.Union["StructB", typing.Dict[str, typing.Any]]]], typing.Sequence[typing.Union[typing.Union["StructA", typing.Dict[str, typing.Any]], typing.Union["StructB", typing.Dict[str, typing.Any]]]]]], ++ union_property: typing.Sequence[typing.Union[typing.Mapping[builtins.str, typing.Union[typing.Union[StructA, typing.Dict[str, typing.Any]], typing.Union[StructB, typing.Dict[str, typing.Any]]]], typing.Sequence[typing.Union[typing.Union[StructA, typing.Dict[str, typing.Any]], typing.Union[StructB, typing.Dict[str, typing.Any]]]]]], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -14705,7 +14985,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ) -> None: + if __debug__: + def stub( -+ value: typing.List[typing.Union[typing.Mapping[builtins.str, typing.Union["StructA", "StructB"]], typing.List[typing.Union["StructA", "StructB"]]]], ++ value: typing.List[typing.Union[typing.Mapping[builtins.str, typing.Union[StructA, StructB]], typing.List[typing.Union[StructA, StructB]]]], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -14723,7 +15003,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ) -> None: + if __debug__: + def stub( -+ value: typing.Optional[typing.Union[scope.jsii_calc_lib.IFriendly, typing.List[typing.Union[scope.jsii_calc_lib.IFriendly, "AbstractClass"]]]], ++ value: typing.Optional[typing.Union[scope.jsii_calc_lib.IFriendly, typing.List[typing.Union[scope.jsii_calc_lib.IFriendly, AbstractClass]]]], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -14742,7 +15022,7 @@ exports[`Generated code for "jsii-calc": /python/src/js + if __debug__: + def stub( + *, -+ union_property: typing.Optional[typing.Union[scope.jsii_calc_lib.IFriendly, typing.Sequence[typing.Union[scope.jsii_calc_lib.IFriendly, "AbstractClass"]]]] = None, ++ union_property: typing.Optional[typing.Union[scope.jsii_calc_lib.IFriendly, typing.Sequence[typing.Union[scope.jsii_calc_lib.IFriendly, AbstractClass]]]] = None, + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -14759,7 +15039,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param consumer: - ''' + if __debug__: -+ def stub(consumer: "PartiallyInitializedThisConsumer") -> None: ++ def stub(consumer: PartiallyInitializedThisConsumer) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument consumer", value=consumer, expected_type=type_hints["consumer"]) @@ -14775,7 +15055,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param delegate: - ''' + if __debug__: -+ def stub(delegate: "IStructReturningDelegate") -> None: ++ def stub(delegate: IStructReturningDelegate) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument delegate", value=delegate, expected_type=type_hints["delegate"]) @@ -14791,7 +15071,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param ringer: - ''' + if __debug__: -+ def stub(ringer: "IBellRinger") -> None: ++ def stub(ringer: IBellRinger) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument ringer", value=ringer, expected_type=type_hints["ringer"]) @@ -14807,7 +15087,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param ringer: - ''' + if __debug__: -+ def stub(ringer: "IBellRinger") -> None: ++ def stub(ringer: IBellRinger) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument ringer", value=ringer, expected_type=type_hints["ringer"]) @@ -14823,7 +15103,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param ringer: - ''' + if __debug__: -+ def stub(ringer: "IBellRinger") -> None: ++ def stub(ringer: IBellRinger) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument ringer", value=ringer, expected_type=type_hints["ringer"]) @@ -14839,7 +15119,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param ringer: - ''' + if __debug__: -+ def stub(ringer: "IConcreteBellRinger") -> None: ++ def stub(ringer: IConcreteBellRinger) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument ringer", value=ringer, expected_type=type_hints["ringer"]) @@ -14854,7 +15134,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param ringer: - ''' + if __debug__: -+ def stub(ringer: "IBellRinger") -> None: ++ def stub(ringer: IBellRinger) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument ringer", value=ringer, expected_type=type_hints["ringer"]) @@ -14869,7 +15149,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param ringer: - ''' + if __debug__: -+ def stub(ringer: "IBellRinger") -> None: ++ def stub(ringer: IBellRinger) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument ringer", value=ringer, expected_type=type_hints["ringer"]) @@ -14884,7 +15164,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param ringer: - ''' + if __debug__: -+ def stub(ringer: "IBellRinger") -> None: ++ def stub(ringer: IBellRinger) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument ringer", value=ringer, expected_type=type_hints["ringer"]) @@ -14899,7 +15179,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param ringer: - ''' + if __debug__: -+ def stub(ringer: "IConcreteBellRinger") -> None: ++ def stub(ringer: IConcreteBellRinger) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument ringer", value=ringer, expected_type=type_hints["ringer"]) @@ -14915,7 +15195,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param obj: - ''' + if __debug__: -+ def stub(obj: "IAnotherPublicInterface") -> None: ++ def stub(obj: IAnotherPublicInterface) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument obj", value=obj, expected_type=type_hints["obj"]) @@ -14930,7 +15210,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param obj: - ''' + if __debug__: -+ def stub(obj: "INonInternalInterface") -> None: ++ def stub(obj: INonInternalInterface) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument obj", value=obj, expected_type=type_hints["obj"]) @@ -14948,9 +15228,9 @@ exports[`Generated code for "jsii-calc": /python/src/js + if __debug__: + def stub( + *, -+ array_prop: typing.Sequence[typing.Union["DummyObj", typing.Dict[str, typing.Any]]], -+ obj_prop: typing.Mapping[builtins.str, typing.Union["DummyObj", typing.Dict[str, typing.Any]]], -+ record_prop: typing.Mapping[builtins.str, typing.Union["DummyObj", typing.Dict[str, typing.Any]]], ++ array_prop: typing.Sequence[typing.Union[DummyObj, typing.Dict[str, typing.Any]]], ++ obj_prop: typing.Mapping[builtins.str, typing.Union[DummyObj, typing.Dict[str, typing.Any]]], ++ record_prop: typing.Mapping[builtins.str, typing.Union[DummyObj, typing.Dict[str, typing.Any]]], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -15078,7 +15358,7 @@ exports[`Generated code for "jsii-calc": /python/src/js + first_optional: typing.Optional[typing.Sequence[builtins.str]] = None, + another_required: datetime.datetime, + bool: builtins.bool, -+ non_primitive: "DoubleTrouble", ++ non_primitive: DoubleTrouble, + another_optional: typing.Optional[typing.Mapping[builtins.str, scope.jsii_calc_lib.NumericValue]] = None, + optional_any: typing.Any = None, + optional_array: typing.Optional[typing.Sequence[builtins.str]] = None, @@ -15363,7 +15643,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param clock: your implementation of \`\`WallClock\`\`. ''' + if __debug__: -+ def stub(clock: "IWallClock") -> None: ++ def stub(clock: IWallClock) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument clock", value=clock, expected_type=type_hints["clock"]) @@ -15396,7 +15676,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ''' + if __debug__: + def stub( -+ opts: typing.Union["EraseUndefinedHashValuesOptions", typing.Dict[str, typing.Any]], ++ opts: typing.Union[EraseUndefinedHashValuesOptions, typing.Dict[str, typing.Any]], + key: builtins.str, + ) -> None: + ... @@ -15637,7 +15917,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param bell: - ''' + if __debug__: -+ def stub(bell: "Bell") -> None: ++ def stub(bell: Bell) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument bell", value=bell, expected_type=type_hints["bell"]) @@ -15998,7 +16278,7 @@ exports[`Generated code for "jsii-calc": /python/src/js + if __debug__: + def stub( + *, -+ prop: typing.Union["LevelOne.PropBooleanValue", typing.Dict[str, typing.Any]], ++ prop: typing.Union[LevelOne.PropBooleanValue, typing.Dict[str, typing.Any]], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) @@ -16680,7 +16960,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @instance.setter # type: ignore[no-redef] def instance(cls, value: "Statics") -> None: + if __debug__: -+ def stub(value: "Statics") -> None: ++ def stub(value: Statics) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument value", value=value, expected_type=type_hints["value"]) @@ -16793,7 +17073,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param inputs: - ''' + if __debug__: -+ def stub(_positional: jsii.Number, *inputs: "TopLevelStruct") -> None: ++ def stub(_positional: jsii.Number, *inputs: TopLevelStruct) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument _positional", value=_positional, expected_type=type_hints["_positional"]) @@ -17252,7 +17532,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param method: - ''' + if __debug__: -+ def stub(method: "VariadicMethod") -> None: ++ def stub(method: VariadicMethod) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument method", value=method, expected_type=type_hints["method"]) @@ -17820,7 +18100,7 @@ exports[`Generated code for "jsii-calc": /python/src/js @string_style.setter def string_style(self, value: "CompositeOperation.CompositionStringStyle") -> None: + if __debug__: -+ def stub(value: "CompositeOperation.CompositionStringStyle") -> None: ++ def stub(value: CompositeOperation.CompositionStringStyle) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument value", value=value, expected_type=type_hints["value"]) @@ -17852,6 +18132,86 @@ exports[`Generated code for "jsii-calc": /python/src/js Base, `; +exports[`Generated code for "jsii-calc": /python/src/jsii_calc/homonymous_forward_references/bar/__init__.py.diff 1`] = ` +--- python/src/jsii_calc/homonymous_forward_references/bar/__init__.py --no-runtime-type-checking ++++ python/src/jsii_calc/homonymous_forward_references/bar/__init__.py --runtime-type-checking +@@ -46,10 +46,18 @@ + ''' + :param homonymous: + ''' + if isinstance(homonymous, dict): + homonymous = Homonymous(**homonymous) ++ if __debug__: ++ def stub( ++ *, ++ homonymous: typing.Union[Homonymous, typing.Dict[str, typing.Any]], ++ ) -> None: ++ ... ++ type_hints = typing.get_type_hints(stub) ++ check_type(argname="argument homonymous", value=homonymous, expected_type=type_hints["homonymous"]) + self._values: typing.Dict[str, typing.Any] = { + "homonymous": homonymous, + } + + @builtins.property +@@ -78,10 +86,15 @@ + class Homonymous: + def __init__(self, *, numeric_property: jsii.Number) -> None: + ''' + :param numeric_property: + ''' ++ if __debug__: ++ def stub(*, numeric_property: jsii.Number) -> None: ++ ... ++ type_hints = typing.get_type_hints(stub) ++ check_type(argname="argument numeric_property", value=numeric_property, expected_type=type_hints["numeric_property"]) + self._values: typing.Dict[str, typing.Any] = { + "numeric_property": numeric_property, + } + + @builtins.property +`; + +exports[`Generated code for "jsii-calc": /python/src/jsii_calc/homonymous_forward_references/foo/__init__.py.diff 1`] = ` +--- python/src/jsii_calc/homonymous_forward_references/foo/__init__.py --no-runtime-type-checking ++++ python/src/jsii_calc/homonymous_forward_references/foo/__init__.py --runtime-type-checking +@@ -46,10 +46,18 @@ + ''' + :param homonymous: + ''' + if isinstance(homonymous, dict): + homonymous = Homonymous(**homonymous) ++ if __debug__: ++ def stub( ++ *, ++ homonymous: typing.Union[Homonymous, typing.Dict[str, typing.Any]], ++ ) -> None: ++ ... ++ type_hints = typing.get_type_hints(stub) ++ check_type(argname="argument homonymous", value=homonymous, expected_type=type_hints["homonymous"]) + self._values: typing.Dict[str, typing.Any] = { + "homonymous": homonymous, + } + + @builtins.property +@@ -78,10 +86,15 @@ + class Homonymous: + def __init__(self, *, string_property: builtins.str) -> None: + ''' + :param string_property: + ''' ++ if __debug__: ++ def stub(*, string_property: builtins.str) -> None: ++ ... ++ type_hints = typing.get_type_hints(stub) ++ check_type(argname="argument string_property", value=string_property, expected_type=type_hints["string_property"]) + self._values: typing.Dict[str, typing.Any] = { + "string_property": string_property, + } + + @builtins.property +`; + exports[`Generated code for "jsii-calc": /python/src/jsii_calc/interface_in_namespace_includes_classes/__init__.py.diff 1`] = ` --- python/src/jsii_calc/interface_in_namespace_includes_classes/__init__.py --no-runtime-type-checking +++ python/src/jsii_calc/interface_in_namespace_includes_classes/__init__.py --runtime-type-checking @@ -17941,7 +18301,7 @@ exports[`Generated code for "jsii-calc": /python/src/js :param receiver: - ''' + if __debug__: -+ def stub(receiver: "OverrideMe") -> None: ++ def stub(receiver: OverrideMe) -> None: + ... + type_hints = typing.get_type_hints(stub) + check_type(argname="argument receiver", value=receiver, expected_type=type_hints["receiver"]) @@ -18357,7 +18717,7 @@ exports[`Generated code for "jsii-calc": /python/src/js ''' + if __debug__: + def stub( -+ param: typing.Union["IResolvable", "Resolvable", scope.jsii_calc_lib.IFriendly], ++ param: typing.Union[IResolvable, Resolvable, scope.jsii_calc_lib.IFriendly], + ) -> None: + ... + type_hints = typing.get_type_hints(stub) diff --git a/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap b/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap index c8be186d6e..bcff47d4bf 100644 --- a/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/jsii-tree.test.js.snap @@ -160,6 +160,53 @@ exports[`jsii-tree --all 1`] = ` β”‚ β”‚ β”‚ └─┬ enum CompositionStringStyle (stable) β”‚ β”‚ β”‚ β”œβ”€β”€ NORMAL (stable) β”‚ β”‚ β”‚ └── DECORATED (stable) + β”‚ β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ β”‚ β”œβ”€β”¬ submodules + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ bar + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ class Consumer (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ static consume(props) method (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ static + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ parameters + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ props + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── type: jsii-calc.homonymousForwardReferences.bar.ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── returns: jsii-calc.homonymousForwardReferences.bar.Homonymous + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ interface ConsumerProps (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ homonymous property (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ abstract + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ immutable + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── type: jsii-calc.homonymousForwardReferences.bar.Homonymous + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ interface Homonymous (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ numericProperty property (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ abstract + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ immutable + β”‚ β”‚ β”‚ β”‚ β”‚ └── type: number + β”‚ β”‚ β”‚ β”‚ └─┬ foo + β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ class Consumer (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ static consume(props) method (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ static + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ parameters + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ props + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── type: jsii-calc.homonymousForwardReferences.foo.ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ └── returns: jsii-calc.homonymousForwardReferences.foo.Homonymous + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ interface ConsumerProps (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ homonymous property (stable) + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ abstract + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ immutable + β”‚ β”‚ β”‚ β”‚ β”‚ └── type: jsii-calc.homonymousForwardReferences.foo.Homonymous + β”‚ β”‚ β”‚ β”‚ └─┬ interface Homonymous (stable) + β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ └─┬ stringProperty property (stable) + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ abstract + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ immutable + β”‚ β”‚ β”‚ β”‚ └── type: string + β”‚ β”‚ β”‚ └── types β”‚ β”‚ β”œβ”€β”¬ jsii3656 β”‚ β”‚ β”‚ └─┬ types β”‚ β”‚ β”‚ β”œβ”€β”¬ class OverrideMe (stable) @@ -3585,6 +3632,19 @@ exports[`jsii-tree --inheritance 1`] = ` β”‚ β”‚ β”‚ β”œβ”€β”¬ class CompositeOperation β”‚ β”‚ β”‚ β”‚ └── base: Operation β”‚ β”‚ β”‚ └── enum CompositionStringStyle + β”‚ β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ β”‚ β”œβ”€β”¬ submodules + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ bar + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ class Consumer + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ └── interface Homonymous + β”‚ β”‚ β”‚ β”‚ └─┬ foo + β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ class Consumer + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ └── interface Homonymous + β”‚ β”‚ β”‚ └── types β”‚ β”‚ β”œβ”€β”¬ jsii3656 β”‚ β”‚ β”‚ └─┬ types β”‚ β”‚ β”‚ β”œβ”€β”€ class OverrideMe @@ -4142,6 +4202,31 @@ exports[`jsii-tree --members 1`] = ` β”‚ β”‚ β”‚ └─┬ enum CompositionStringStyle β”‚ β”‚ β”‚ β”œβ”€β”€ NORMAL β”‚ β”‚ β”‚ └── DECORATED + β”‚ β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ β”‚ β”œβ”€β”¬ submodules + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ bar + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ class Consumer + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── static consume(props) method + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── homonymous property + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ interface Homonymous + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ └── numericProperty property + β”‚ β”‚ β”‚ β”‚ └─┬ foo + β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ class Consumer + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ └── static consume(props) method + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ └── homonymous property + β”‚ β”‚ β”‚ β”‚ └─┬ interface Homonymous + β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ └── stringProperty property + β”‚ β”‚ β”‚ └── types β”‚ β”‚ β”œβ”€β”¬ jsii3656 β”‚ β”‚ β”‚ └─┬ types β”‚ β”‚ β”‚ β”œβ”€β”¬ class OverrideMe @@ -5679,6 +5764,10 @@ exports[`jsii-tree --signatures 1`] = ` β”‚ β”‚ └─┬ submodules β”‚ β”‚ └── donotimport β”‚ β”œβ”€β”€ composition + β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ └─┬ submodules + β”‚ β”‚ β”œβ”€β”€ bar + β”‚ β”‚ └── foo β”‚ β”œβ”€β”€ jsii3656 β”‚ β”œβ”€β”€ module2530 β”‚ β”œβ”€β”€ module2617 @@ -5757,6 +5846,19 @@ exports[`jsii-tree --types 1`] = ` β”‚ β”‚ β”‚ └─┬ types β”‚ β”‚ β”‚ β”œβ”€β”€ class CompositeOperation β”‚ β”‚ β”‚ └── enum CompositionStringStyle + β”‚ β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ β”‚ β”œβ”€β”¬ submodules + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ bar + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ class Consumer + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ └── interface Homonymous + β”‚ β”‚ β”‚ β”‚ └─┬ foo + β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ class Consumer + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ └── interface Homonymous + β”‚ β”‚ β”‚ └── types β”‚ β”‚ β”œβ”€β”¬ jsii3656 β”‚ β”‚ β”‚ └─┬ types β”‚ β”‚ β”‚ β”œβ”€β”€ class OverrideMe @@ -6140,6 +6242,10 @@ exports[`jsii-tree 1`] = ` β”‚ β”‚ └─┬ submodules β”‚ β”‚ └── donotimport β”‚ β”œβ”€β”€ composition + β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ └─┬ submodules + β”‚ β”‚ β”œβ”€β”€ bar + β”‚ β”‚ └── foo β”‚ β”œβ”€β”€ jsii3656 β”‚ β”œβ”€β”€ module2530 β”‚ β”œβ”€β”€ module2617 diff --git a/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap b/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap index a349bff7b0..fe083d3a8d 100644 --- a/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/tree.test.js.snap @@ -13,6 +13,10 @@ exports[`defaults 1`] = ` β”‚ β”‚ └─┬ submodules β”‚ β”‚ └── donotimport β”‚ β”œβ”€β”€ composition + β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ └─┬ submodules + β”‚ β”‚ β”œβ”€β”€ bar + β”‚ β”‚ └── foo β”‚ β”œβ”€β”€ jsii3656 β”‚ β”œβ”€β”€ module2530 β”‚ β”œβ”€β”€ module2617 @@ -67,6 +71,10 @@ exports[`inheritance 1`] = ` β”‚ β”‚ └─┬ submodules β”‚ β”‚ └── donotimport β”‚ β”œβ”€β”€ composition + β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ └─┬ submodules + β”‚ β”‚ β”œβ”€β”€ bar + β”‚ β”‚ └── foo β”‚ β”œβ”€β”€ jsii3656 β”‚ β”œβ”€β”€ module2530 β”‚ β”œβ”€β”€ module2617 @@ -121,6 +129,10 @@ exports[`members 1`] = ` β”‚ β”‚ └─┬ submodules β”‚ β”‚ └── donotimport β”‚ β”œβ”€β”€ composition + β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ └─┬ submodules + β”‚ β”‚ β”œβ”€β”€ bar + β”‚ β”‚ └── foo β”‚ β”œβ”€β”€ jsii3656 β”‚ β”œβ”€β”€ module2530 β”‚ β”œβ”€β”€ module2617 @@ -322,6 +334,53 @@ exports[`showAll 1`] = ` β”‚ β”‚ β”‚ └─┬ enum CompositionStringStyle β”‚ β”‚ β”‚ β”œβ”€β”€ NORMAL β”‚ β”‚ β”‚ └── DECORATED + β”‚ β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ β”‚ β”œβ”€β”¬ submodules + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ bar + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ class Consumer + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ static consume(props) method + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ static + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ parameters + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ props + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── type: jsii-calc.homonymousForwardReferences.bar.ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── returns: jsii-calc.homonymousForwardReferences.bar.Homonymous + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ homonymous property + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ abstract + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ immutable + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── type: jsii-calc.homonymousForwardReferences.bar.Homonymous + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ interface Homonymous + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ numericProperty property + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ abstract + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ immutable + β”‚ β”‚ β”‚ β”‚ β”‚ └── type: number + β”‚ β”‚ β”‚ β”‚ └─┬ foo + β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ class Consumer + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ static consume(props) method + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ static + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ parameters + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ props + β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └── type: jsii-calc.homonymousForwardReferences.foo.ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ └── returns: jsii-calc.homonymousForwardReferences.foo.Homonymous + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ homonymous property + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ abstract + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ immutable + β”‚ β”‚ β”‚ β”‚ β”‚ └── type: jsii-calc.homonymousForwardReferences.foo.Homonymous + β”‚ β”‚ β”‚ β”‚ └─┬ interface Homonymous + β”‚ β”‚ β”‚ β”‚ └─┬ members + β”‚ β”‚ β”‚ β”‚ └─┬ stringProperty property + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ abstract + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ immutable + β”‚ β”‚ β”‚ β”‚ └── type: string + β”‚ β”‚ β”‚ └── types β”‚ β”‚ β”œβ”€β”¬ jsii3656 β”‚ β”‚ β”‚ └─┬ types β”‚ β”‚ β”‚ β”œβ”€β”¬ class OverrideMe @@ -3720,6 +3779,10 @@ exports[`signatures 1`] = ` β”‚ β”‚ └─┬ submodules β”‚ β”‚ └── donotimport β”‚ β”œβ”€β”€ composition + β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ └─┬ submodules + β”‚ β”‚ β”œβ”€β”€ bar + β”‚ β”‚ └── foo β”‚ β”œβ”€β”€ jsii3656 β”‚ β”œβ”€β”€ module2530 β”‚ β”œβ”€β”€ module2617 @@ -3798,6 +3861,19 @@ exports[`types 1`] = ` β”‚ β”‚ β”‚ └─┬ types β”‚ β”‚ β”‚ β”œβ”€β”€ class CompositeOperation β”‚ β”‚ β”‚ └── enum CompositionStringStyle + β”‚ β”‚ β”œβ”€β”¬ homonymousForwardReferences + β”‚ β”‚ β”‚ β”œβ”€β”¬ submodules + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”¬ bar + β”‚ β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ class Consumer + β”‚ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ β”‚ └── interface Homonymous + β”‚ β”‚ β”‚ β”‚ └─┬ foo + β”‚ β”‚ β”‚ β”‚ └─┬ types + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ class Consumer + β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ interface ConsumerProps + β”‚ β”‚ β”‚ β”‚ └── interface Homonymous + β”‚ β”‚ β”‚ └── types β”‚ β”‚ β”œβ”€β”¬ jsii3656 β”‚ β”‚ β”‚ └─┬ types β”‚ β”‚ β”‚ β”œβ”€β”€ class OverrideMe diff --git a/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap b/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap index 8e045fcafd..d319565582 100644 --- a/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap +++ b/packages/jsii-reflect/test/__snapshots__/type-system.test.js.snap @@ -165,6 +165,8 @@ exports[`TypeSystem.classes lists all the classes in the typesystem 1`] = ` "jsii-calc.cdk16625.Cdk16625", "jsii-calc.cdk16625.donotimport.UnimportedSubmoduleType", "jsii-calc.composition.CompositeOperation", + "jsii-calc.homonymousForwardReferences.bar.Consumer", + "jsii-calc.homonymousForwardReferences.foo.Consumer", "jsii-calc.jsii3656.OverrideMe", "jsii-calc.module2530.MyClass", "jsii-calc.module2617.OnlyStatics", From 4fe0d348b4a9691f4c4aa1849540edf195b73e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BB=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier?= Date: Wed, 2 Nov 2022 09:36:03 +0100 Subject: [PATCH 2/2] chore: credit bug reporters --- .all-contributorsrc | 18 +++++++++++++++ README.md | 56 +++++++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index aca2df0c7d..9b4194ba18 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1486,6 +1486,24 @@ "contributions": [ "bug" ] + }, + { + "login": "shamelesscookie", + "name": "Christian Moore", + "avatar_url": "https://avatars.githubusercontent.com/u/36210509?v=4", + "profile": "https://christianmoore.me/", + "contributions": [ + "bug" + ] + }, + { + "login": "khellan", + "name": "Knut O. Hellan", + "avatar_url": "https://avatars.githubusercontent.com/u/51441?v=4", + "profile": "http://findable.no/", + "contributions": [ + "bug" + ] } ], "repoType": "github", diff --git a/README.md b/README.md index 62757f009d..31fdd51c01 100644 --- a/README.md +++ b/README.md @@ -93,158 +93,160 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Chris Garvis

πŸ“– +
Christian Moore

πŸ›
Christophe Vico

πŸ›
Christopher Currie

πŸ’» πŸ€”
Christopher Rybicki

πŸ“– πŸ› πŸ’»
CommanderRoot

πŸ’»
Cory Hall

πŸ› -
Cristian Măgherușan-Stanciu

πŸ› +
Cristian Măgherușan-Stanciu

πŸ›
CyrusNajmabadi

πŸ› πŸ€”
Damian Silbergleith

πŸ’» πŸ›
Daniel Dinu

πŸ› πŸ’»
Daniel Schmidt

πŸ› πŸ’»
Daniel Schroeder

πŸ› πŸ’» πŸ“– πŸ€” 🚧
Dave Slotnick

πŸ› -
Donald Stufft

πŸ› πŸ’» πŸ€” πŸ‘€ +
Donald Stufft

πŸ› πŸ’» πŸ€” πŸ‘€
Dongie Agnir

πŸ’» πŸ‘€
Eduardo Rabelo

πŸ“–
Eduardo Sena S. Rosa

πŸ›
Elad Ben-Israel

πŸ› πŸ’» πŸ€” 🚧 πŸ‘€ πŸ“’
Eli Polonsky

πŸ› πŸ’» πŸ€” 🚧 πŸ‘€
Eric Z. Beard

πŸ“† -
Erik Karlsson

πŸ› +
Erik Karlsson

πŸ›
Eugene Kozlov

πŸ’»
Fabio Gentile

πŸ›
Florian Eitel

πŸ€”
Glib Shpychka

πŸ›
Graham Lea

πŸ€” πŸ‘€
Hamza Assyad

πŸ› πŸ’» πŸ€” πŸ‘€ -
Hari Pachuveetil

πŸ“ πŸ“– +
Hari Pachuveetil

πŸ“ πŸ“–
Hsing-Hui Hsu

πŸ’» πŸ“– πŸ€” πŸ‘€
Ikko Ashimine

πŸ“–
James

πŸ› πŸ’»
James Kelley

πŸ›
James Mead

πŸ’»
James Siri

πŸ’» 🚧 -
Jason Del Ponte

πŸ€” πŸ‘€ +
Jason Del Ponte

πŸ€” πŸ‘€
Jason Fulghum

πŸ€” πŸ“† πŸ‘€
Jeff Malins

πŸ’»
Jerry Kindall

πŸ“– πŸ€”
Jimmy Gaussen

πŸ€”
Johannes Weber

πŸ“–
Jon Steinich

πŸ› πŸ€” πŸ’» -
Joseph Lawson

πŸ‘€ +
Joseph Lawson

πŸ‘€
Joseph Martin

πŸ›
Junix

πŸ›
Justin Frahm

πŸ›
Justin Taylor

πŸ›
Kaizen Conroy

πŸ’» πŸ›
Kaizen Conroy

πŸ’» -
Kaushik Borra

πŸ› +
Kaushik Borra

πŸ› +
Knut O. Hellan

πŸ›
Kyle Thomson

πŸ’» πŸ‘€
Leandro Padua

πŸ›
Liang Zhou

πŸ› πŸ’»
Madeline Kusters

πŸ’» πŸ›
Maja S Bratseth

πŸ› -
Marcos Diez

πŸ› -
Mark Nielsen

πŸ’» +
Marcos Diez

πŸ› +
Mark Nielsen

πŸ’»
Matthew Bonig

πŸ› πŸ“
Matthew Pirocchi

πŸ’» πŸ€” πŸ‘€
Meng Xin Zhu

πŸ›
Michael Neil

🚧
Mike Lane

πŸ› -
Mitch Garnaat

πŸ› πŸ’» πŸ€” πŸ‘€ -
Mitchell Valine

πŸ› πŸ’» πŸ€” 🚧 πŸ‘€ +
Mitch Garnaat

πŸ› πŸ’» πŸ€” πŸ‘€ +
Mitchell Valine

πŸ› πŸ’» πŸ€” 🚧 πŸ‘€
Mohamad Soufan

πŸ“–
Mykola Mogylenko

πŸ›
Naumel

πŸ‘€
Neta Nir

πŸ’» πŸ€” 🚧 πŸ‘€
Nick Lynch

πŸ› πŸ’» 🚧 πŸ‘€ -
Niranjan Jayakar

πŸ› πŸ’» πŸ€” 🚧 πŸ‘€ -
Noah Litov

πŸ’» 🚧 πŸ‘€ +
Niranjan Jayakar

πŸ› πŸ’» πŸ€” 🚧 πŸ‘€ +
Noah Litov

πŸ’» 🚧 πŸ‘€
Otavio Macedo

πŸ’» πŸ›
PIDZ - Bart

πŸ€”
Peter Woodworth

🚧
Petr Kacer

πŸ›
Petra Barus

πŸ’» -
Philip Cali

πŸ€” -
Quentin Loos

πŸ€” +
Philip Cali

πŸ€” +
Quentin Loos

πŸ€”
Raphael

πŸ›
Richard H Boyd

πŸ›
Rico Huijbers

πŸ› πŸ’» πŸ€” 🚧 πŸ‘€
Romain Marcadier

πŸ› πŸ’» 🎨 πŸ€” 🚧 πŸ‘€ πŸ“
SADIK KUZU

πŸ‘€ -
SK

πŸ€” -
Sam Fink

πŸ’» πŸ‘€ +
SK

πŸ€” +
Sam Fink

πŸ’» πŸ‘€
Sam Goodwin

πŸ‘€
Sebastian Korfmann

πŸ› πŸ’» πŸ€”
Sepehr Laal

πŸ›
Shane Witbeck

πŸ€”
Shiv Lakshminarayan

πŸ’» 🚧 πŸ‘€ -
Somaya

πŸ’» πŸ€” 🚧 πŸ‘€ -
Stephen Kuenzli

πŸ“– +
Somaya

πŸ’» πŸ€” 🚧 πŸ‘€ +
Stephen Kuenzli

πŸ“–
Takahiro Sugiura

πŸ“–
The Gitter Badger

πŸ’» 🚧
Thomas Poignant

πŸ›
Thomas Steinbach

πŸ›
Thorsten Hoeger

πŸ’» -
Tim Wagner

πŸ› πŸ€” -
Tobias Lidskog

πŸ’» +
Tim Wagner

πŸ› πŸ€” +
Tobias Lidskog

πŸ’»
Ty Coghlan

πŸ›
Tyler van Hensbergen

πŸ€”
Vlad Hrybok

πŸ›
Vladimir Shchur

πŸ›
Yan Zhulanow

πŸ’» -
Yigong Liu

πŸ› πŸ€” -
Zach Bienenfeld

πŸ› +
Yigong Liu

πŸ› πŸ€” +
Zach Bienenfeld

πŸ›
ajnarang

πŸ€”
aniljava

πŸ’»
arnogeurts-sqills

πŸ› πŸ’»
cn-cit

πŸ›
deccy-mcc

πŸ› -
dependabot-preview[bot]

πŸ› 🚧 -
dependabot[bot]

🚧 +
dependabot-preview[bot]

πŸ› 🚧 +
dependabot[bot]

🚧
dheffx

πŸ›
gregswdl

πŸ›
guyroberts21

πŸ“–
mattBrzezinski

πŸ“–
mergify

🚧 -
mergify[bot]

🚧 -
nathannaveen

🚧 +
mergify[bot]

🚧 +
nathannaveen

🚧
seiyashima42

πŸ› πŸ’» πŸ“–
sullis

πŸ’»
vaneek

πŸ›