From 92440a649bf549d38d8617808e19048fbd33e666 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Fri, 22 Nov 2024 13:13:07 -0800 Subject: [PATCH 01/32] m --- TestModels/OrphanedShapes/Makefile | 48 ++++++ .../Model/OrphanedShapes.smithy | 46 ++++++ .../OrphanedShapes/src/OrphanedResource.dfy | 69 ++++++++ .../src/SimpleOrphanedShapesImpl.dfy | 50 ++++++ .../test/OrphanedShapesTest.dfy | 151 ++++++++++++++++++ .../OrphanedShapes/test/WrappedTest.dfy | 28 ++++ ...irectedDafnyPythonLocalServiceCodegen.java | 31 ++++ 7 files changed, 423 insertions(+) create mode 100644 TestModels/OrphanedShapes/Makefile create mode 100644 TestModels/OrphanedShapes/Model/OrphanedShapes.smithy create mode 100644 TestModels/OrphanedShapes/src/OrphanedResource.dfy create mode 100644 TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy create mode 100644 TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy create mode 100644 TestModels/OrphanedShapes/test/WrappedTest.dfy diff --git a/TestModels/OrphanedShapes/Makefile b/TestModels/OrphanedShapes/Makefile new file mode 100644 index 0000000000..b39ff14345 --- /dev/null +++ b/TestModels/OrphanedShapes/Makefile @@ -0,0 +1,48 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +CORES=2 + +ENABLE_EXTERN_PROCESSING=1 +TRANSPILE_TESTS_IN_RUST=1 + +include ../SharedMakefile.mk + +NAMESPACE=simple.positional + +PROJECT_SERVICES := \ + SimplePositional + +MAIN_SERVICE_FOR_RUST := SimplePositional + +SERVICE_NAMESPACE_SimplePositional=simple.positional + +SERVICE_DEPS_SimplePositional := + +SMITHY_DEPS=dafny-dependencies/Model/traits.smithy + +# This project has no dependencies +# DEPENDENT-MODELS:= + +POLYMORPH_OPTIONS=--generate project-files,client-constructors + +# Python + +PYTHON_MODULE_NAME=simple_positional + +TRANSLATION_RECORD_PYTHON := \ + --translation-record ../dafny-dependencies/StandardLibrary/runtimes/python/src/smithy_dafny_standard_library/internaldafny/generated/dafny_src-py.dtr + +# Constants for languages that drop extern names (Python, Go) + +TYPES_FILE_PATH=Model/SimplePositionalTypes.dfy +TYPES_FILE_WITH_EXTERN_STRING="module {:extern \"simple.positional.internaldafny.types\" } SimplePositionalTypes" +TYPES_FILE_WITHOUT_EXTERN_STRING="module SimplePositionalTypes" + +INDEX_FILE_PATH=src/Index.dfy +INDEX_FILE_WITH_EXTERN_STRING="module {:extern \"simple.positional.internaldafny\" } SimplePositional refines AbstractSimplePositionalService {" +INDEX_FILE_WITHOUT_EXTERN_STRING="module SimplePositional refines AbstractSimplePositionalService {" + +WRAPPED_INDEX_FILE_PATH=src/WrappedSimplePositionalImpl.dfy +WRAPPED_INDEX_FILE_WITH_EXTERN_STRING="module {:options \"--function-syntax:4\"} {:extern \"simple.positional.internaldafny.wrapped\"} WrappedSimplePositionalService refines WrappedAbstractSimplePositionalService {" +WRAPPED_INDEX_FILE_WITHOUT_EXTERN_STRING="module {:options \"--function-syntax:4\"} WrappedSimplePositionalService refines WrappedAbstractSimplePositionalService {" diff --git a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy new file mode 100644 index 0000000000..032adea24d --- /dev/null +++ b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy @@ -0,0 +1,46 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +$version: "2" +namespace simple.orphanedShapes + +@aws.polymorph#localService( + sdkId: "SimpleLocalService", + config: SimpleLocalServiceConfig, +) +service SimpleLocalService { + version: "2021-11-01", + resources: [], + operations: [HelloWorld, SelfReflection], + errors: [ SimpleLocalServiceException ], +} + +structure SimpleLocalServiceConfig {} + +@error("client") +structure SimpleLocalServiceException { + @required + message: String, +} + +@aws.polymorph#reference(service: SimpleLocalService) +structure SimpleLocalServiceReference {} + +operation SelfReflection { + input := { + @required + client: SimpleLocalServiceReference + } + output := { + @required + greeting: String + } +} + +operation HelloWorld { + input := { + } + output := { + @required + greeting: String + } +} \ No newline at end of file diff --git a/TestModels/OrphanedShapes/src/OrphanedResource.dfy b/TestModels/OrphanedShapes/src/OrphanedResource.dfy new file mode 100644 index 0000000000..601071bd5c --- /dev/null +++ b/TestModels/OrphanedShapes/src/OrphanedResource.dfy @@ -0,0 +1,69 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +include "../Model/SimpleResourcesTypes.dfy" + +module SimpleResource { + import opened StandardLibrary + import opened Wrappers + import Types = SimpleResourcesTypes + + class SimpleResource extends Types.ISimpleResource + { + predicate ValidState() + ensures ValidState() ==> History in Modifies + { + && History in Modifies + } + + const name: string + const value: Option + + constructor ( + value: Option, + name: string + ) + requires |name| > 0 + ensures this.value == value + ensures this.name == name + ensures ValidState() && fresh(History) && fresh(Modifies) + { + this.value := value; + this.name := name; + + History := new Types.ISimpleResourceCallHistory(); + Modifies := {History}; + } + + predicate GetResourceDataEnsuresPublicly( + input: Types.GetResourceDataInput, + output: Result + ) {true} + + method GetResourceData'( + input: Types.GetResourceDataInput + ) returns ( + output: Result + ) + requires ValidState() + modifies Modifies - {History} + decreases Modifies - {History} + ensures && ValidState() + ensures GetResourceDataEnsuresPublicly(input, output) + ensures unchanged(History) + { + var rtnString: string := if input.stringValue.Some? then + this.name + " " + input.stringValue.value + else + this.name; + var rtn: Types.GetResourceDataOutput := Types.GetResourceDataOutput( + blobValue := input.blobValue, + booleanValue := input.booleanValue, + stringValue := Some(rtnString), + integerValue := input.integerValue, + longValue := input.longValue + ); + return Success(rtn); + } + } +} diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy new file mode 100644 index 0000000000..d02db0b1a2 --- /dev/null +++ b/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy @@ -0,0 +1,50 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +include "../Model/SimplePositionalTypes.dfy" +include "./SimpleResource.dfy" +module SimplePositionalImpl refines AbstractSimplePositionalOperations { + import SimpleResource + + datatype Config = Config + type InternalConfig = Config + + predicate ValidInternalConfig?(config: InternalConfig) + {true} + function ModifiesInternalConfig(config: InternalConfig): set + {{}} + predicate GetResourceEnsuresPublicly(input: GetResourceInput , output: Result) + {true} + + + + method GetResource ( config: InternalConfig , input: GetResourceInput ) + returns (output: Result) + + { + var resource := new SimpleResource.SimpleResource( + input.name + ); + var result: GetResourceOutput := GetResourceOutput( + output := resource + ); + return Success(result); + } + + + predicate GetResourcePositionalEnsuresPublicly(input: string , output: Result) + {true} + + + + // @positional allows use to accept the input parameters directly without the input structure + method GetResourcePositional ( config: InternalConfig , input: string ) + returns (output: Result) + + { + var resource := new SimpleResource.SimpleResource(input); + + // @positional allows use to return the result without the output structure + return Success(resource); + } +} diff --git a/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy b/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy new file mode 100644 index 0000000000..fb1241511d --- /dev/null +++ b/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy @@ -0,0 +1,151 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +include "../src/Index.dfy" +include "./Helpers.dfy" +include "../src/MutableResource.dfy" + +module SimpleResourcesTest { + import SimpleResources + import Types = SimpleResourcesTypes + import opened Wrappers + import opened Helpers + + method TestNoneGetData( + config: Types.SimpleResourcesConfig, + resource: Types.ISimpleResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allNone(); + var result :- expect resource.GetResourceData(input); + checkMostNone(config.name, result); + } + + method TestSomeGetData( + config: Types.SimpleResourcesConfig, + resource: Types.ISimpleResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allSome(); + var output :- expect resource.GetResourceData(input); + checkSome(config.name, output); + } + + method TestGetResources( + config: Types.SimpleResourcesConfig, + client: Types.ISimpleResourcesClient + ) returns ( + resource: Types.ISimpleResource + ) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + ensures resource.Modifies !! {client.History} + ensures fresh(resource.Modifies - client.Modifies - {client.History} ) + ensures resource.ValidState() && fresh(resource) + { + var input := Types.GetResourcesInput( + value := Some("Test") + ); + var output :- expect client.GetResources(input); + return output.output; + } + + method TestClient(config: Types.SimpleResourcesConfig) + { + var client :- expect SimpleResources.SimpleResources(config); + var resource := TestGetResources(config, client); + TestNoneGetData(config, resource); + TestSomeGetData(config, resource); + + var mutableResource := TestGetMutableResources(config, client); + TestMutableNoneGetData(config, mutableResource); + TestMutableSomeGetData(config, mutableResource); + } + + method {:test} TestDefaultConfig() + { + TestClient(SimpleResources.DefaultSimpleResourcesConfig()); + } + + method {:test} TestCustomConfig() + { + TestClient(Types.SimpleResourcesConfig(name := "Dafny")); + } + + // This is breaking encapsulation + // this is not something for public clients to do. + // this is to access the internal state and verify that specific things are true/false. + import MutableResource = MutableResource`ForTesting + + method TestMutableNoneGetData( + config: Types.SimpleResourcesConfig, + resource: Types.IMutableResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allMutableNone(); + + expect resource is MutableResource.MutableResource; + var test:MutableResource.MutableResource := resource; + + var before := test.MyInternalState; + + var result :- expect resource.GetMutableResourceData(input); + checkMutableMostNone(config.name, result); + + // This sort of things SHOULD NOT be able to be proved. + // Dafny does not have a way to say `assert something is impossible to prove;` + // assert before != test.MyInternalState; + + // This is assuming that everything verifies + // Given that, the Dafny in MutableResource + // was able to prove MutableResource, + // and the Types file was correct + // This is a basic check to make sure + // that this simplified separated class works. + expect before + 1 == test.MyInternalState; + } + + method TestMutableSomeGetData( + config: Types.SimpleResourcesConfig, + resource: Types.IMutableResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allMutableSome(); + var output :- expect resource.GetMutableResourceData(input); + checkMutableSome(config.name, output); + } + + method TestGetMutableResources( + config: Types.SimpleResourcesConfig, + client: Types.ISimpleResourcesClient + ) returns ( + resource: Types.IMutableResource + ) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + ensures resource.Modifies !! {client.History} + ensures fresh(resource.Modifies - client.Modifies - {client.History} ) + ensures resource.ValidState() && fresh(resource) + { + var input := Types.GetMutableResourcesInput( + value := Some("Test") + ); + var output :- expect client.GetMutableResources(input); + return output.output; + } + +} diff --git a/TestModels/OrphanedShapes/test/WrappedTest.dfy b/TestModels/OrphanedShapes/test/WrappedTest.dfy new file mode 100644 index 0000000000..dbb599154b --- /dev/null +++ b/TestModels/OrphanedShapes/test/WrappedTest.dfy @@ -0,0 +1,28 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +include "../src/WrappedIndex.dfy" +include "./SimpleResourcesTest.dfy" + +module WrappedTest { + import opened SimpleResourcesTest + import WrappedSimpleResources + import opened Types = SimpleResourcesTypes + import opened Wrappers + + method TestWrappedClient(config: Types.SimpleResourcesConfig) + { + var client :- expect WrappedSimpleResources.WrappedSimpleResources(config); + var resource := TestGetResources(config, client); + TestNoneGetData(config, resource); + TestSomeGetData(config, resource); + } + + method {:test} WrappedTestDefaultConfig() { + TestWrappedClient(WrappedSimpleResources.WrappedDefaultSimpleResourcesConfig()); + } + + method {:test} WrappedTestCustomConfig() { + TestWrappedClient(Types.SimpleResourcesConfig(name := "Dafny")); + } +} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 4e3dadf6d7..29444cc09b 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -12,6 +12,8 @@ import software.amazon.polymorph.smithypython.common.nameresolver.SmithyNameResolver; import software.amazon.polymorph.smithypython.localservice.DafnyLocalServiceCodegenConstants; import software.amazon.polymorph.smithypython.localservice.customize.ReferencesFileWriter; +import software.amazon.polymorph.smithypython.localservice.shapevisitor.conversionwriter.DafnyToLocalServiceConversionFunctionWriter; +import software.amazon.polymorph.smithypython.localservice.shapevisitor.conversionwriter.LocalServiceToDafnyConversionFunctionWriter; import software.amazon.smithy.build.FileManifest; import software.amazon.smithy.codegen.core.*; import software.amazon.smithy.codegen.core.directed.*; @@ -522,6 +524,35 @@ protected void generateOrphanedShapesForService( shapeToGenerate ); } + + final WriterDelegator delegator = directive.context().writerDelegator(); + final String moduleName = + SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( + directive.context().settings().getService().getNamespace() + ); + + delegator.useFileWriter( + moduleName + "/dafny_to_smithy.py", + "", + conversionWriter -> { + DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + + delegator.useFileWriter( + moduleName + "/smithy_to_dafny.py", + "", + conversionWriter -> { + LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + } } From 60160ab36f1b99d4b22ae4aad327b5baf4ed3add Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Fri, 22 Nov 2024 13:26:22 -0800 Subject: [PATCH 02/32] m --- .../DirectedDafnyPythonLocalServiceCodegen.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 29444cc09b..1058b340f8 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -508,15 +508,20 @@ protected void generateOrphanedShapesForService( directive.context() ); } else if (shapeToGenerate.isStringShape()) { - // Classes are not generated for strings + // Neither classes nor converisons are generated for strings + continue; } else if (shapeToGenerate.isIntegerShape()) { - // Classes are not generated for ints + // Neither classes nor converisons are generated for ints + continue; } else if (shapeToGenerate.isListShape()) { - // Classes are not generated for lists + // Neither classes nor converisons are generated for lists + continue; } else if (shapeToGenerate.isMapShape()) { - // Classes are not generated for maps + // Neither classes nor converisons are generated for maps + continue; } else if (shapeToGenerate.isLongShape()) { - // Classes are not generated for longs + // Neither classes nor converisons are generated for longs + continue; } else { // Add more as needed... throw new ClassCastException( From 2f49bfc3fe048549d1f689a66dd439f277ca5769 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Fri, 22 Nov 2024 13:35:23 -0800 Subject: [PATCH 03/32] m --- .../extensions/DirectedDafnyPythonLocalServiceCodegen.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 1058b340f8..b9924edc03 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -494,6 +494,8 @@ protected void generateOrphanedShapesForService( structureShape, directive.context() ); + // Errors don't get conversion functions + continue } else { writeStructureShape(structureShape, directive.context()); } From 080a0d782f1d0223c1d9d40f167471b4ab10a59a Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Fri, 22 Nov 2024 13:36:03 -0800 Subject: [PATCH 04/32] m --- .../extensions/DirectedDafnyPythonLocalServiceCodegen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index b9924edc03..2a3762a123 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -495,7 +495,7 @@ protected void generateOrphanedShapesForService( directive.context() ); // Errors don't get conversion functions - continue + continue; } else { writeStructureShape(structureShape, directive.context()); } From ea69572504e355a1761f77872110e1b338b284fe Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Fri, 22 Nov 2024 13:44:52 -0800 Subject: [PATCH 05/32] m --- ...irectedDafnyPythonLocalServiceCodegen.java | 85 +++++++++++++------ 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 2a3762a123..4ca084f8bb 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -18,6 +18,7 @@ import software.amazon.smithy.codegen.core.*; import software.amazon.smithy.codegen.core.directed.*; import software.amazon.smithy.model.shapes.*; +import software.amazon.smithy.model.traits.EnumTrait; import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.python.codegen.*; @@ -494,7 +495,9 @@ protected void generateOrphanedShapesForService( structureShape, directive.context() ); - // Errors don't get conversion functions + // Errors don't get explicit conversion functions; + // Conversions are done in a catch-all function + // (This could be changed in the future) continue; } else { writeStructureShape(structureShape, directive.context()); @@ -511,7 +514,6 @@ protected void generateOrphanedShapesForService( ); } else if (shapeToGenerate.isStringShape()) { // Neither classes nor converisons are generated for strings - continue; } else if (shapeToGenerate.isIntegerShape()) { // Neither classes nor converisons are generated for ints continue; @@ -531,35 +533,57 @@ protected void generateOrphanedShapesForService( shapeToGenerate ); } + } + } - final WriterDelegator delegator = directive.context().writerDelegator(); - final String moduleName = - SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( - directive.context().settings().getService().getNamespace() - ); + /** + * This MUST run after code generation for non-orphaned shapes. + * Orphaned shapes may topologically depend on non-orphaned shapes, but not vice versa. + * + * @param directive + */ + protected void generateOrphanedConversionMethods( + GenerateServiceDirective directive + ) { + List orderedShapes = getTopologicallyOrderedOrphanedShapesForService( + directive.shape(), + directive.model() + ); - delegator.useFileWriter( - moduleName + "/dafny_to_smithy.py", - "", - conversionWriter -> { - DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( - shapeToGenerate, - directive.context(), - conversionWriter - ); - }); - - delegator.useFileWriter( - moduleName + "/smithy_to_dafny.py", - "", - conversionWriter -> { - LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( - shapeToGenerate, - directive.context(), - conversionWriter + for (Shape shapeToGenerate : orderedShapes) { + + if (shapeToGenerate.isStructureShape() + || shapeToGenerate.isEnumShape() + || shapeToGenerate.isStringShape() && shapeToGenerate.hasTrait(EnumTrait.class)) + { + final WriterDelegator delegator = directive.context().writerDelegator(); + final String moduleName = + SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( + directive.context().settings().getService().getNamespace() ); - }); + delegator.useFileWriter( + moduleName + "/dafny_to_smithy.py", + "", + conversionWriter -> { + DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + + delegator.useFileWriter( + moduleName + "/smithy_to_dafny.py", + "", + conversionWriter -> { + LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + } } } @@ -598,6 +622,13 @@ public void generateService( protocolGenerator.generateSharedDeserializerComponents(directive.context()); protocolGenerator.generateResponseDeserializers(directive.context()); + // Generate any missing converison functions + // This MUST run after RequestSerialization and ResponseSerialization generation + // to preserve topological ordering of generated functions. + // (An orphaned conversion function MAY depend on a non-orphaned conversion function, + // but never the other way around.) + generateOrphanedConversionMethods(directive); + protocolGenerator.generateProtocolTests(directive.context()); } } From e01c79d0ba413fa517d42cccddad75d1cfef571b Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Fri, 22 Nov 2024 14:12:36 -0800 Subject: [PATCH 06/32] m --- .../conversionwriter/BaseConversionWriter.java | 16 ++++++++++++++++ .../DirectedDafnyPythonLocalServiceCodegen.java | 17 ++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java index 4f2317929e..a621cf2d91 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java @@ -13,6 +13,7 @@ import software.amazon.smithy.model.shapes.StructureShape; import software.amazon.smithy.model.shapes.UnionShape; import software.amazon.smithy.model.traits.EnumTrait; +import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.python.codegen.GenerationContext; import software.amazon.smithy.python.codegen.PythonWriter; @@ -121,4 +122,19 @@ protected abstract void writeStructureShapeConverter( protected abstract void writeStringEnumShapeConverter( StringShape stringShapeWithEnumTrait ); + + public static boolean shapeShouldHaveConversionFunction(Shape shape) { + if (shape.isStructureShape()) { + if (shape.hasTrait(ErrorTrait.class)) { + return false; + } + } else if (shape.isUnionShape()) { + return true; + } else if ( + (shape.isStringShape() && shape.hasTrait(EnumTrait.class)) + || shape.isEnumShape()) { + return true; + } + return false; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 4ca084f8bb..9261218f69 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -5,6 +5,8 @@ import static java.lang.String.format; import static software.amazon.polymorph.utils.ModelUtils.getTopologicallyOrderedOrphanedShapesForService; +import static software.amazon.polymorph.smithypython.common.shapevisitor.conversionwriter.BaseConversionWriter.shapeShouldHaveConversionFunction; + import java.nio.file.Path; import java.util.List; @@ -542,7 +544,7 @@ protected void generateOrphanedShapesForService( * * @param directive */ - protected void generateOrphanedConversionMethods( + protected void generateOrphanedShapeConversionMethods( GenerateServiceDirective directive ) { List orderedShapes = getTopologicallyOrderedOrphanedShapesForService( @@ -552,9 +554,7 @@ protected void generateOrphanedConversionMethods( for (Shape shapeToGenerate : orderedShapes) { - if (shapeToGenerate.isStructureShape() - || shapeToGenerate.isEnumShape() - || shapeToGenerate.isStringShape() && shapeToGenerate.hasTrait(EnumTrait.class)) + if (shapeShouldHaveConversionFunction(shapeToGenerate)) { final WriterDelegator delegator = directive.context().writerDelegator(); final String moduleName = @@ -622,12 +622,15 @@ public void generateService( protocolGenerator.generateSharedDeserializerComponents(directive.context()); protocolGenerator.generateResponseDeserializers(directive.context()); - // Generate any missing converison functions - // This MUST run after RequestSerialization and ResponseSerialization generation + // Generate any missing conversion. functions + // This SHOULD run after generateRequestSerializers and generateResponseDeserializers // to preserve topological ordering of generated functions. + // I don't think that topological ordering is required here + // (no function's top-level definition depend on another function in this file) + // but this could change in the far future, so best to preserve the correct ordering. // (An orphaned conversion function MAY depend on a non-orphaned conversion function, // but never the other way around.) - generateOrphanedConversionMethods(directive); + generateOrphanedShapeConversionMethods(directive); protocolGenerator.generateProtocolTests(directive.context()); } From 56a1be6c7091c5fd979535431c27b8426d8abefa Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Fri, 22 Nov 2024 14:15:39 -0800 Subject: [PATCH 07/32] m --- .../shapevisitor/conversionwriter/BaseConversionWriter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java index a621cf2d91..17996b2c67 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java @@ -128,6 +128,7 @@ public static boolean shapeShouldHaveConversionFunction(Shape shape) { if (shape.hasTrait(ErrorTrait.class)) { return false; } + return true; } else if (shape.isUnionShape()) { return true; } else if ( From 39e8c5eb9534014a90d71874da10dfc507d13673 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 4 Dec 2024 16:52:55 -0800 Subject: [PATCH 08/32] POCs for net, java, python --- TestModels/OrphanedShapes/Makefile | 28 +-- .../Model/OrphanedShapes.smithy | 176 +++++++++++++++--- TestModels/OrphanedShapes/README.md | 54 ++++++ .../runtimes/java/build.gradle.kts | 80 ++++++++ .../java/Dafny/simple/orphaned/__default.java | 5 + .../simple/orphaned/types/__default.java | 5 + .../SimpleOrphanedImpl_Compile/__default.java | 45 +++++ .../internaldafny/wrapped/__default.java | 32 ++++ .../SimpleOrphanedShapesImpl_Compile.cs | 31 +++ .../WrappedSimpleOrphanedShapesService.cs | 19 ++ .../net/ImplementationFromDafny-cs.dtr | 14 ++ .../runtimes/net/SimpleOrphanedShapes.csproj | 29 +++ .../net/tests/SimpleOrphanedShapesTest.csproj | 26 +++ .../runtimes/net/tests/TestsFromDafny-cs.dtr | 8 + .../runtimes/python/pyproject.toml | 26 +++ .../src/simple_orphaned_shapes/__init__.py | 8 + .../extern/SimpleOrphanedShapesImpl.py | 31 +++ .../internaldafny/extern/__init__.py | 3 + .../python/test/internaldafny/__init__.py | 2 + .../test/internaldafny/extern/__init__.py | 0 .../extern/wrapped_orphaned_resource.py | 7 + .../extern/wrapped_simple_orphaned_shapes.py | 22 +++ .../test/internaldafny/test_dafny_wrapper.py | 24 +++ .../OrphanedShapes/runtimes/python/tox.ini | 13 ++ TestModels/OrphanedShapes/src/Index.dfy | 31 +++ .../OrphanedShapes/src/OrphanedResource.dfy | 59 +++--- .../OrphanedShapes/src/SimpleOrphanedImpl.dfy | 105 +++++++++++ .../src/SimpleOrphanedShapesImpl.dfy | 50 ----- .../src/WrappedSimpleOrphanedImpl.dfy | 10 + .../test/OrphanedShapesTest.dfy | 151 --------------- .../OrphanedShapes/test/WrappedTest.dfy | 52 ++++-- .../net/ImplementationFromDafny-cs.dtr | 7 +- .../BaseConversionWriter.java | 16 ++ ...irectedDafnyPythonLocalServiceCodegen.java | 8 +- 34 files changed, 874 insertions(+), 303 deletions(-) create mode 100644 TestModels/OrphanedShapes/README.md create mode 100644 TestModels/OrphanedShapes/runtimes/java/build.gradle.kts create mode 100644 TestModels/OrphanedShapes/runtimes/java/src/main/java/Dafny/simple/orphaned/__default.java create mode 100644 TestModels/OrphanedShapes/runtimes/java/src/main/java/Dafny/simple/orphaned/types/__default.java create mode 100644 TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedImpl_Compile/__default.java create mode 100644 TestModels/OrphanedShapes/runtimes/java/src/test/java/simple/orphaned/internaldafny/wrapped/__default.java create mode 100644 TestModels/OrphanedShapes/runtimes/net/Extern/SimpleOrphanedShapesImpl_Compile.cs create mode 100644 TestModels/OrphanedShapes/runtimes/net/Extern/WrappedSimpleOrphanedShapesService.cs create mode 100644 TestModels/OrphanedShapes/runtimes/net/ImplementationFromDafny-cs.dtr create mode 100644 TestModels/OrphanedShapes/runtimes/net/SimpleOrphanedShapes.csproj create mode 100644 TestModels/OrphanedShapes/runtimes/net/tests/SimpleOrphanedShapesTest.csproj create mode 100644 TestModels/OrphanedShapes/runtimes/net/tests/TestsFromDafny-cs.dtr create mode 100644 TestModels/OrphanedShapes/runtimes/python/pyproject.toml create mode 100644 TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/__init__.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/SimpleOrphanedShapesImpl.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/__init__.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/test/internaldafny/__init__.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/__init__.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_orphaned_resource.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned_shapes.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/tox.ini create mode 100644 TestModels/OrphanedShapes/src/Index.dfy create mode 100644 TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy delete mode 100644 TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy create mode 100644 TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy delete mode 100644 TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy diff --git a/TestModels/OrphanedShapes/Makefile b/TestModels/OrphanedShapes/Makefile index b39ff14345..6934bbce7e 100644 --- a/TestModels/OrphanedShapes/Makefile +++ b/TestModels/OrphanedShapes/Makefile @@ -8,16 +8,16 @@ TRANSPILE_TESTS_IN_RUST=1 include ../SharedMakefile.mk -NAMESPACE=simple.positional +NAMESPACE=simple.orphaned PROJECT_SERVICES := \ - SimplePositional + SimpleOrphaned -MAIN_SERVICE_FOR_RUST := SimplePositional +MAIN_SERVICE_FOR_RUST := SimpleOrphaned -SERVICE_NAMESPACE_SimplePositional=simple.positional +SERVICE_NAMESPACE_SimpleOrphaned=simple.orphaned -SERVICE_DEPS_SimplePositional := +SERVICE_DEPS_SimpleOrphaned := SMITHY_DEPS=dafny-dependencies/Model/traits.smithy @@ -28,21 +28,21 @@ POLYMORPH_OPTIONS=--generate project-files,client-constructors # Python -PYTHON_MODULE_NAME=simple_positional +PYTHON_MODULE_NAME=simple_orphaned TRANSLATION_RECORD_PYTHON := \ --translation-record ../dafny-dependencies/StandardLibrary/runtimes/python/src/smithy_dafny_standard_library/internaldafny/generated/dafny_src-py.dtr # Constants for languages that drop extern names (Python, Go) -TYPES_FILE_PATH=Model/SimplePositionalTypes.dfy -TYPES_FILE_WITH_EXTERN_STRING="module {:extern \"simple.positional.internaldafny.types\" } SimplePositionalTypes" -TYPES_FILE_WITHOUT_EXTERN_STRING="module SimplePositionalTypes" +TYPES_FILE_PATH=Model/SimpleOrphanedTypes.dfy +TYPES_FILE_WITH_EXTERN_STRING="module {:extern \"simple.orphaned.internaldafny.types\" } SimpleOrphanedTypes" +TYPES_FILE_WITHOUT_EXTERN_STRING="module SimpleOrphanedTypes" INDEX_FILE_PATH=src/Index.dfy -INDEX_FILE_WITH_EXTERN_STRING="module {:extern \"simple.positional.internaldafny\" } SimplePositional refines AbstractSimplePositionalService {" -INDEX_FILE_WITHOUT_EXTERN_STRING="module SimplePositional refines AbstractSimplePositionalService {" +INDEX_FILE_WITH_EXTERN_STRING="module {:extern \"simple.orphaned.internaldafny\" } SimpleOrphaned refines AbstractSimpleOrphanedService {" +INDEX_FILE_WITHOUT_EXTERN_STRING="module SimpleOrphaned refines AbstractSimpleOrphanedService {" -WRAPPED_INDEX_FILE_PATH=src/WrappedSimplePositionalImpl.dfy -WRAPPED_INDEX_FILE_WITH_EXTERN_STRING="module {:options \"--function-syntax:4\"} {:extern \"simple.positional.internaldafny.wrapped\"} WrappedSimplePositionalService refines WrappedAbstractSimplePositionalService {" -WRAPPED_INDEX_FILE_WITHOUT_EXTERN_STRING="module {:options \"--function-syntax:4\"} WrappedSimplePositionalService refines WrappedAbstractSimplePositionalService {" +WRAPPED_INDEX_FILE_PATH=src/WrappedSimpleOrphanedImpl.dfy +WRAPPED_INDEX_FILE_WITH_EXTERN_STRING="module {:options \"--function-syntax:4\"} {:extern \"simple.orphaned.internaldafny.wrapped\"} WrappedSimpleOrphanedService refines WrappedAbstractSimpleOrphanedService {" +WRAPPED_INDEX_FILE_WITHOUT_EXTERN_STRING="module {:options \"--function-syntax:4\"} WrappedSimpleOrphanedService refines WrappedAbstractSimpleOrphanedService {" diff --git a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy index 032adea24d..503ffe13b3 100644 --- a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy +++ b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy @@ -1,46 +1,162 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 + $version: "2" -namespace simple.orphanedShapes +namespace simple.orphaned @aws.polymorph#localService( - sdkId: "SimpleLocalService", - config: SimpleLocalServiceConfig, + sdkId: "SimpleOrphaned", + config: SimpleOrphanedConfig, ) -service SimpleLocalService { +service SimpleOrphaned { version: "2021-11-01", resources: [], - operations: [HelloWorld, SelfReflection], - errors: [ SimpleLocalServiceException ], + operations: [ + CreateOrphanedStructure, + CreateOrphanedResource, + CreateOrphanedError, + ], +} + +structure SimpleOrphanedConfig { + structureMember: OrphanedConfigShape +} + +structure OrphanedConfigShape { + stringMember: String +} + +blob OrphanedBlob + +boolean OrphanedBoolean + +string OrphanedString + +// TODO: Once SimpleTypes for commented-out shapes are completed, +// uncomment these and add as members to OrphanedStructure +// byte OrphanedByte + +// short OrphanedShort + +integer OrphanedInteger + +long OrphanedLong + +// float OrphanedFloat + +// double OrphanedDouble + +// bigInteger OrphanedBigInteger + +// bigDecimal OrphanedBigDecimal + +// timestamp OrphanedTimestamp + +// document OrphanedDocument + +// This is a smithy V1 Enum +@enum([ + { + name: "FIRST", + value: "0x0014", + }, + { + name: "SECOND", + value: "0x0046", + }, + { + name: "THIRD", + value: "0x0078", + }, +]) +string OrphanedV1Enum + +list OrphanedList { + member: String +} + +map OrphanedMap { + key: String + value: String } -structure SimpleLocalServiceConfig {} +structure OrphanedStructure { + blobValue: OrphanedBlob, + booleanValue: OrphanedBoolean, + stringValue: OrphanedString, + // byteValue: OrphanedByte, + // shortValue: OrphanedShort, + integerValue: OrphanedInteger, + longValue: OrphanedLong, + // floatValue: OrphanedFloat, + // doubleValue: OrphanedDouble, + // bigIntegerValue: OrphanedBigInteger, + // bigDecimalValue: OrphanedBigDecimal, + // timestampValue: OrphanedTimestamp, + unionValue: OrphanedUnion, + structureValue: OrphanedStructure, + enumValue: OrphanedV1Enum, + mapValue: OrphanedMap, + listValue: OrphanedList +} + +union OrphanedUnion { + integerValue: Integer + stringValue: String +} @error("client") -structure SimpleLocalServiceException { +structure OrphanedError { @required message: String, } -@aws.polymorph#reference(service: SimpleLocalService) -structure SimpleLocalServiceReference {} - -operation SelfReflection { - input := { - @required - client: SimpleLocalServiceReference - } - output := { - @required - greeting: String - } -} - -operation HelloWorld { - input := { - } - output := { - @required - greeting: String - } -} \ No newline at end of file +@aws.polymorph#reference(resource: OrphanedResource) +structure OrphanedResourceReference {} + +@aws.polymorph#extendable +resource OrphanedResource { + operations: [ + OrphanedResourceOperation + ] +} + +operation OrphanedResourceOperation { + input: OrphanedResourceOperationInput + output: OrphanedResourceOperationOutput +} + +structure OrphanedResourceOperationInput { + someString: String +} + +structure OrphanedResourceOperationOutput { + someString: String +} + +operation CreateOrphanedStructure { + input: CreateOrphanedStructureInput + output: CreateOrphanedStructureOutput +} + +structure CreateOrphanedStructureInput {} + +structure CreateOrphanedStructureOutput {} + +operation CreateOrphanedResource { + input: CreateOrphanedResourceInput + output: CreateOrphanedResourceOutput +} + +structure CreateOrphanedResourceInput {} + +structure CreateOrphanedResourceOutput {} + +operation CreateOrphanedError { + input: CreateOrphanedErrorInput + output: CreateOrphanedErrorOutput +} + +structure CreateOrphanedErrorInput {} + +structure CreateOrphanedErrorOutput {} diff --git a/TestModels/OrphanedShapes/README.md b/TestModels/OrphanedShapes/README.md new file mode 100644 index 0000000000..e1380a1aca --- /dev/null +++ b/TestModels/OrphanedShapes/README.md @@ -0,0 +1,54 @@ +# OrphanedShapes + +## Background + +This project tests for support of "orphaned" shapes. + +An "orphaned" is a shape that exists in a Smithy model, but is not discovered by Smithy-Core's shape discovery logic. + +Smithy-Core will only discover and generate code for shapes that are attached to a service via the service's +1. Operations +2. Mixins +3. Errors + +and recursive traversals of the connected shapes. + +If a shape is defined in a Smithy model, +but not declared in a LocalService's operations or errors +(or recursive traversals of these), +codegens that use Smithy-Core's shape discovery will not generate code for the shape. +(Similar for mixins, but Polymorph doesn't have any usage of these at the moment.) + +Smithy-Dafny .NET and Java generate code for orphaned shapes because these codegens don't use Smithy-Core's shape discovery logic. + +By default, any language extending a "real" Smithy code generator use Smithy-Core's shape discovery logic, and do not support orphaned shapes. + +The expectation is that code is generated for orphaned shapes. +The generated code must include any class definitions and Dafny/native conversions. + +## Prerequisites + +This TestModel assumes these other TestModels are passing: + +- Extern +- Extendable +- LocalService +- Union +- Aggregate +- Enum + +and these TestModels' prerequisite TestModels. + +## Coverage + +This TestModel tests some instances of orphaned shapes +- LocalService Config shapes. These are "orphaned", but are likely already handled as one-offs by any codegen that's this TestModels' prerequisites. +- Errors +- Resources (with @aws.polymorph#reference trait) and their operations +- Structures (and structures' members) + +The "key" to this TestModel is in the extern implementations. +The externs require passing some orphaned shapes across the Dafny layer. +The extern implementations MUST call Polymorph-generated native shapes and Dafny/native conversions for these orphaned shapes. +However, Polymorph will only generate these shapes and conversions if the language's codegen supports orphaned shapes. +So if this language generates these conversions, then it supports orphaned shapes. diff --git a/TestModels/OrphanedShapes/runtimes/java/build.gradle.kts b/TestModels/OrphanedShapes/runtimes/java/build.gradle.kts new file mode 100644 index 0000000000..09b66fb38a --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/java/build.gradle.kts @@ -0,0 +1,80 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import java.io.File +import java.io.FileInputStream +import java.util.Properties +import java.net.URI +import javax.annotation.Nullable + +tasks.wrapper { + gradleVersion = "7.6" +} + +plugins { + `java-library` + `maven-publish` +} + +var props = Properties().apply { + load(FileInputStream(File(rootProject.rootDir, "../../project.properties"))) +} +var dafnyVersion = props.getProperty("dafnyVersion") + +group = "simple.orphaned" +version = "1.0-SNAPSHOT" +description = "SimpleOrphaned" + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(8)) + sourceSets["main"].java { + srcDir("src/main/java") + srcDir("src/main/dafny-generated") + srcDir("src/main/smithy-generated") + } + sourceSets["test"].java { + srcDir("src/test/java") + srcDir("src/test/dafny-generated") + srcDir("src/test/smithy-generated") + } +} + +repositories { + mavenCentral() + mavenLocal() +} + +dependencies { + implementation("org.dafny:DafnyRuntime:${dafnyVersion}") + implementation("software.amazon.smithy.dafny:conversion:0.1.1") + implementation("software.amazon.cryptography:StandardLibrary:1.0-SNAPSHOT") + testImplementation("org.testng:testng:7.5") +} + +publishing { + publications.create("mavenLocal") { + groupId = group as String? + artifactId = description + from(components["java"]) + } + publications.create("maven") { + groupId = group as String? + artifactId = description + from(components["java"]) + } + repositories { mavenLocal() } +} + +tasks.withType() { + options.encoding = "UTF-8" +} + +tasks { + register("runTests", JavaExec::class.java) { + mainClass.set("TestsFromDafny") + classpath = sourceSets["test"].runtimeClasspath + } +} + +tasks.named("test") { + useTestNG() +} diff --git a/TestModels/OrphanedShapes/runtimes/java/src/main/java/Dafny/simple/orphaned/__default.java b/TestModels/OrphanedShapes/runtimes/java/src/main/java/Dafny/simple/orphaned/__default.java new file mode 100644 index 0000000000..9b96a60104 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/java/src/main/java/Dafny/simple/orphaned/__default.java @@ -0,0 +1,5 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +package simple.orphaned.internaldafny; + +public class __default extends _ExternBase___default {} diff --git a/TestModels/OrphanedShapes/runtimes/java/src/main/java/Dafny/simple/orphaned/types/__default.java b/TestModels/OrphanedShapes/runtimes/java/src/main/java/Dafny/simple/orphaned/types/__default.java new file mode 100644 index 0000000000..846935f550 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/java/src/main/java/Dafny/simple/orphaned/types/__default.java @@ -0,0 +1,5 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +package simple.orphaned.internaldafny.types; + +public class __default extends _ExternBase___default {} diff --git a/TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedImpl_Compile/__default.java b/TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedImpl_Compile/__default.java new file mode 100644 index 0000000000..14a9c391b5 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedImpl_Compile/__default.java @@ -0,0 +1,45 @@ +// Class _ExternBase___default +// Dafny class __default compiled into Java +package SimpleOrphanedImpl_Compile; + +import simple.orphaned.internaldafny.types.*; +import OrphanedResource_Compile.*; +import simple.orphaned.ToDafny; +import simple.orphaned.ToNative; +import Wrappers_Compile.*; + +@SuppressWarnings({"unchecked", "deprecation"}) +public class __default extends _ExternBase___default { + public static simple.orphaned.internaldafny.types.OrphanedStructure InitializeOrphanedStructure(simple.orphaned.internaldafny.types.OrphanedStructure input) { + simple.orphaned.model.OrphanedStructure nativeStructure = ToNative.OrphanedStructure(input); + simple.orphaned.model.OrphanedStructure newNativeStructure = nativeStructure.toBuilder().stringValue( + "the extern MUST use Smithy-generated conversions to set this value in the native structure" + ).build(); + simple.orphaned.internaldafny.types.OrphanedStructure newDafnyStructure = ToDafny.OrphanedStructure(newNativeStructure); + return newDafnyStructure; + } + + public static Result CallNativeOrphanedResource(OrphanedResource_Compile.OrphanedResource input) { + simple.orphaned.IOrphanedResource nativeResource = ToNative.OrphanedResource(input); + simple.orphaned.model.OrphanedResourceOperationOutput output = nativeResource.OrphanedResourceOperation( + simple.orphaned.model.OrphanedResourceOperationInput.builder() + .someString("the extern MUST provide this string to the native resource's operation") + .build() + ); + simple.orphaned.internaldafny.types.OrphanedResourceOperationOutput dafnyOutput = ToDafny.OrphanedResourceOperationOutput(output); + return Result.create_Success( + simple.orphaned.internaldafny.types.OrphanedResourceOperationOutput._typeDescriptor(), + simple.orphaned.internaldafny.types.Error._typeDescriptor(), + dafnyOutput + ); + } + + public static simple.orphaned.internaldafny.types.Error CallNativeOrphanedError(simple.orphaned.internaldafny.types.Error input) { + simple.orphaned.model.OrphanedError nativeError = ToNative.Error((simple.orphaned.internaldafny.types.Error_OrphanedError) input); + simple.orphaned.model.OrphanedError updatedNativeError = nativeError.toBuilder() + .message("the extern MUST use Smithy-generated conversions to set this value in the native error") + .build(); + simple.orphaned.internaldafny.types.Error dafnyErrorAgain = ToDafny.Error(updatedNativeError); + return dafnyErrorAgain; + } +} diff --git a/TestModels/OrphanedShapes/runtimes/java/src/test/java/simple/orphaned/internaldafny/wrapped/__default.java b/TestModels/OrphanedShapes/runtimes/java/src/test/java/simple/orphaned/internaldafny/wrapped/__default.java new file mode 100644 index 0000000000..9a8feca64e --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/java/src/test/java/simple/orphaned/internaldafny/wrapped/__default.java @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +package simple.orphaned.internaldafny.wrapped; + +import Wrappers_Compile.Result; +import simple.orphaned.SimpleOrphaned; +import simple.orphaned.ToNative; +import simple.orphaned.internaldafny.types.Error; +import simple.orphaned.internaldafny.types.ISimpleOrphanedClient; +import simple.orphaned.internaldafny.types.SimpleOrphanedConfig; +import simple.orphaned.wrapped.TestSimpleOrphaned; + +public class __default extends _ExternBase___default { + + public static Result WrappedSimpleOrphaned( + SimpleOrphanedConfig config + ) { + simple.orphaned.model.SimpleOrphanedConfig wrappedConfig = + ToNative.SimpleOrphanedConfig(config); + simple.orphaned.SimpleOrphaned impl = SimpleOrphaned + .builder() + .SimpleOrphanedConfig(wrappedConfig) + .build(); + TestSimpleOrphaned wrappedClient = TestSimpleOrphaned + .builder() + .impl(impl) + .build(); + return simple.orphaned.internaldafny.__default.CreateSuccessOfClient( + wrappedClient + ); + } +} diff --git a/TestModels/OrphanedShapes/runtimes/net/Extern/SimpleOrphanedShapesImpl_Compile.cs b/TestModels/OrphanedShapes/runtimes/net/Extern/SimpleOrphanedShapesImpl_Compile.cs new file mode 100644 index 0000000000..02fa0e407a --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/net/Extern/SimpleOrphanedShapesImpl_Compile.cs @@ -0,0 +1,31 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +using System; +using Dafny; +using simple.orphanedshapes.internaldafny.types; +using Simple.OrphanedShapes; +using Wrappers_Compile; + +namespace SimpleOrphanedShapesImpl_Compile +{ + public partial class __default + { + public static simple.orphanedshapes.internaldafny.types._IOrphanedStructure InitializeOrphanedStructure(simple.orphanedshapes.internaldafny.types._IOrphanedStructure input) + { + // .NET doesn't have this conversion + // Simple.OrphanedShapes.OrphanedStructure nativeStructure = TypeConversion. + } + + public static simple.orphanedshapes.internaldafny.types._IOrphanedResource InitializeOrphanedStructure(simple.orphanedshapes.internaldafny.types._IOrphanedStructure input) + { + // .NET doesn't have this conversion + // Simple.OrphanedShapes.OrphanedStructure nativeStructure = TypeConversion. + } + + public static simple.orphanedshapes.internaldafny.types._IOrphanedResource InitializeOrphanedStructure(simple.orphanedshapes.internaldafny.types._IOrphanedStructure input) + { + // .NET doesn't have this conversion + // Simple.OrphanedShapes.OrphanedStructure nativeStructure = TypeConversion. + } + } +} \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/net/Extern/WrappedSimpleOrphanedShapesService.cs b/TestModels/OrphanedShapes/runtimes/net/Extern/WrappedSimpleOrphanedShapesService.cs new file mode 100644 index 0000000000..ad93064f5c --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/net/Extern/WrappedSimpleOrphanedShapesService.cs @@ -0,0 +1,19 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +using Wrappers_Compile; +using Simple.OrphanedShapes; +using Simple.OrphanedShapes.Wrapped; +using TypeConversion = Simple.OrphanedShapes.TypeConversion; +namespace simple.orphanedshapes.internaldafny.wrapped +{ + public partial class __default + { + public static _IResult WrappedSimpleOrphanedShapes(types._ISimpleOrphanedShapesConfig config) + { + var wrappedConfig = TypeConversion.FromDafny_N6_simple__N14_orphanedShapes__S26_SimpleOrphanedShapesConfig(config); + var impl = new SimpleOrphanedShapes(wrappedConfig); + var wrappedClient = new SimpleOrphanedShapesShim(impl); + return Result.create_Success(wrappedClient); + } + } +} diff --git a/TestModels/OrphanedShapes/runtimes/net/ImplementationFromDafny-cs.dtr b/TestModels/OrphanedShapes/runtimes/net/ImplementationFromDafny-cs.dtr new file mode 100644 index 0000000000..430ea5857d --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/net/ImplementationFromDafny-cs.dtr @@ -0,0 +1,14 @@ +file_format_version = "1.0" +dafny_version = "4.8.0.0" +[options_by_module.SimpleOrphanedShapesTypes] +legacy-module-names = false +[options_by_module.AbstractSimpleOrphanedShapesOperations] +legacy-module-names = false +[options_by_module.AbstractSimpleOrphanedShapesService] +legacy-module-names = false +[options_by_module.OrphanedResource] +legacy-module-names = false +[options_by_module.SimpleOrphanedShapesImpl] +legacy-module-names = false +[options_by_module.SimpleOrphanedShapes] +legacy-module-names = false diff --git a/TestModels/OrphanedShapes/runtimes/net/SimpleOrphanedShapes.csproj b/TestModels/OrphanedShapes/runtimes/net/SimpleOrphanedShapes.csproj new file mode 100644 index 0000000000..1225ee4f78 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/net/SimpleOrphanedShapes.csproj @@ -0,0 +1,29 @@ + + + + SimpleOrphanedShapes + disable + disable + net6.0 + 10 + false + + + + + + + + + + + + + + + + + diff --git a/TestModels/OrphanedShapes/runtimes/net/tests/SimpleOrphanedShapesTest.csproj b/TestModels/OrphanedShapes/runtimes/net/tests/SimpleOrphanedShapesTest.csproj new file mode 100644 index 0000000000..04c5ce631d --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/net/tests/SimpleOrphanedShapesTest.csproj @@ -0,0 +1,26 @@ + + + + SimpleOrphanedShapesTest + disable + disable + net6.0 + 10 + Exe + false + + + + + + + + + + + + + diff --git a/TestModels/OrphanedShapes/runtimes/net/tests/TestsFromDafny-cs.dtr b/TestModels/OrphanedShapes/runtimes/net/tests/TestsFromDafny-cs.dtr new file mode 100644 index 0000000000..2134b215c8 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/net/tests/TestsFromDafny-cs.dtr @@ -0,0 +1,8 @@ +file_format_version = "1.0" +dafny_version = "4.8.0.0" +[options_by_module.WrappedAbstractSimpleOrphanedShapesService] +legacy-module-names = false +[options_by_module.WrappedSimpleOrphanedShapesService] +legacy-module-names = false +[options_by_module.WrappedTest] +legacy-module-names = false diff --git a/TestModels/OrphanedShapes/runtimes/python/pyproject.toml b/TestModels/OrphanedShapes/runtimes/python/pyproject.toml new file mode 100644 index 0000000000..c35aaba19a --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/pyproject.toml @@ -0,0 +1,26 @@ +[tool.poetry] +name = "simple-orphaned-shapes" +version = "0.1.0" +description = "" +authors = ["AWS "] +packages = [ + { include = "simple_orphaned_shapes", from = "src" } +] +# Include all of the following .gitignored files in package distributions, +# even though it is not included in version control +include = ["**/smithygenerated/**/*.py", "**/internaldafny/generated/*.py"] + +[tool.poetry.dependencies] +python = "^3.11.0" +# TODO: Depend on PyPi once Smithy-Python publishes their Python package there +smithy-python = { path = "../../../../codegen/smithy-dafny-codegen-modules/smithy-python/python-packages/smithy-python", develop = false} + +smithy-dafny-standard-library = {path = "../../../dafny-dependencies/StandardLibrary/runtimes/python", develop = false} +DafnyRuntimePython = "^4.7.0" + +[tool.poetry.group.test.dependencies] +pytest = "^7.4.0" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/__init__.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/__init__.py new file mode 100644 index 0000000000..b9427e19da --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/__init__.py @@ -0,0 +1,8 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Initialize generated Dafny +from .internaldafny.generated import module_ + +# Initialize externs +from .internaldafny import extern diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/SimpleOrphanedShapesImpl.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/SimpleOrphanedShapesImpl.py new file mode 100644 index 0000000000..57b9dddfcc --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/SimpleOrphanedShapesImpl.py @@ -0,0 +1,31 @@ +import simple_orphaned_shapes.internaldafny.generated.SimpleOrphanedShapesImpl +from simple_orphaned_shapes.internaldafny.generated.SimpleOrphanedShapesImpl import * + +class default__(simple_orphaned_shapes.internaldafny.generated.SimpleOrphanedShapesImpl.default__): + + @staticmethod + def InitializeOrphanedStructure(dafny_uninitialized_structure): + native_structure = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.dafny_to_smithy.simple_orphanedshapes_OrphanedStructure(dafny_uninitialized_structure) + native_structure.string_value = "the extern MUST use Smithy-generated conversions to set this value in the native structure" + dafny_initialized_structure = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.smithy_to_dafny.simple_orphanedshapes_OrphanedStructure(native_structure) + return dafny_initialized_structure + + @staticmethod + def CallNativeOrphanedResource(dafny_resource): + native_resource = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.dafny_to_smithy.simple_orphanedshapes_OrphanedResourceReference(dafny_resource) + out = native_resource.orphaned_resource_operation( + simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.models.OrphanedResourceOperationInput( + some_string = "the extern MUST provide this string to the native resource's operation" + ) + ) + dafny_resource_again = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.smithy_to_dafny.simple_orphanedshapes_OrphanedResourceReference(native_resource) + return dafny_resource_again + + @staticmethod + def CallNativeOrphanedError(dafny_error): + native_error = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.deserialize._deserialize_error(dafny_error) + native_error.message = "the extern MUST use Smithy-generated conversions to set this value in the native error" + dafny_error_again = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.errors._smithy_error_to_dafny_error(native_error) + return dafny_error_again + +simple_orphaned_shapes.internaldafny.generated.SimpleOrphanedShapesImpl.default__ = default__ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/__init__.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/__init__.py new file mode 100644 index 0000000000..7c9af13c11 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/__init__.py @@ -0,0 +1,3 @@ +from . import ( + SimpleOrphanedShapesImpl, +) \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/__init__.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/__init__.py new file mode 100644 index 0000000000..76a5b798a2 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/__init__.py @@ -0,0 +1,2 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/__init__.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_orphaned_resource.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_orphaned_resource.py new file mode 100644 index 0000000000..41dc5910ac --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_orphaned_resource.py @@ -0,0 +1,7 @@ +from simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.references import OrphanedResource + +class default__: + @staticmethod + def WrappedResource(): + native_resource = OrphanedResource() + dafny_resource = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.smithy_to_dafny. \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned_shapes.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned_shapes.py new file mode 100644 index 0000000000..ca3c209937 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned_shapes.py @@ -0,0 +1,22 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# src imports +from simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.client import SimpleOrphanedShapes +from simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.shim import SimpleOrphanedShapesShim +from simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.config import dafny_config_to_smithy_config +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers + +# test imports, not qualified since this isn't in a package +import WrappedSimpleOrphanedShapesService + +class default__(WrappedSimpleOrphanedShapesService.default__): + + @staticmethod + def WrappedSimpleOrphanedShapes(config): + wrapped_config = dafny_config_to_smithy_config(config) + impl = SimpleOrphanedShapes(wrapped_config) + wrapped_client = SimpleOrphanedShapesShim(impl) + return Wrappers.Result_Success(wrapped_client) + +WrappedSimpleOrphanedShapesService.default__ = default__ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py new file mode 100644 index 0000000000..c09393cead --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py @@ -0,0 +1,24 @@ +""" +Wrapper file for executing Dafny tests from pytest. +This allows us to import modules required by Dafny-generated tests +before executing Dafny-generated tests. +pytest will find and execute the `test_dafny` method below, +which will execute the `__main__.py` file in the `dafny` directory. +""" + +import sys + +# Dafny-generated tests are not compiled as a package +# and require adding Dafny-generated test code to PYTHONPATH. +# These files are only on PYTHONPATH for tests executed from this file. + +internaldafny_dir = '/'.join(__file__.split("/")[:-1]) + +sys.path.append(internaldafny_dir + "/extern") +sys.path.append(internaldafny_dir + "/generated") + +# Initialize extern for test +from .extern import wrapped_simple_orphaned_shapes + +def test_dafny(): + from .generated import __main__ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/tox.ini b/TestModels/OrphanedShapes/runtimes/python/tox.ini new file mode 100644 index 0000000000..56e7f688e3 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/tox.ini @@ -0,0 +1,13 @@ +[tox] +isolated_build = True +envlist = + py{312} + +[testenv] +skip_install = true +allowlist_externals = poetry +commands_pre = + poetry lock + poetry install +commands = + poetry run pytest -s -v test/ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/src/Index.dfy b/TestModels/OrphanedShapes/src/Index.dfy new file mode 100644 index 0000000000..2fe489ca2f --- /dev/null +++ b/TestModels/OrphanedShapes/src/Index.dfy @@ -0,0 +1,31 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +include "SimpleOrphanedImpl.dfy" + +module {:extern "simple.orphaned.internaldafny" } SimpleOrphaned refines AbstractSimpleOrphanedService { + import Operations = SimpleOrphanedImpl + + function method DefaultSimpleOrphanedConfig(): SimpleOrphanedConfig { + SimpleOrphanedConfig + } + + method SimpleOrphaned(config: SimpleOrphanedConfig) + returns (res: Result) + { + var client := new SimpleOrphanedClient(Operations.Config); + return Success(client); + } + + class SimpleOrphanedClient... { + predicate ValidState() { + && Operations.ValidInternalConfig?(config) + && Modifies == Operations.ModifiesInternalConfig(config) + {History} + } + + constructor(config: Operations.InternalConfig) { + this.config := config; + History := new ISimpleOrphanedClientCallHistory(); + Modifies := Operations.ModifiesInternalConfig(config) + {History}; + } + } +} diff --git a/TestModels/OrphanedShapes/src/OrphanedResource.dfy b/TestModels/OrphanedShapes/src/OrphanedResource.dfy index 601071bd5c..6a7e123bcf 100644 --- a/TestModels/OrphanedShapes/src/OrphanedResource.dfy +++ b/TestModels/OrphanedShapes/src/OrphanedResource.dfy @@ -1,69 +1,54 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -include "../Model/SimpleResourcesTypes.dfy" +include "../Model/SimpleOrphanedTypes.dfy" -module SimpleResource { +// This resource is orphaned in the Smithy model. +module OrphanedResource { import opened StandardLibrary import opened Wrappers - import Types = SimpleResourcesTypes + import Types = SimpleOrphanedTypes - class SimpleResource extends Types.ISimpleResource + class OrphanedResource extends Types.IOrphanedResource { predicate ValidState() ensures ValidState() ==> History in Modifies { && History in Modifies } - - const name: string - const value: Option constructor ( - value: Option, - name: string ) - requires |name| > 0 - ensures this.value == value - ensures this.name == name - ensures ValidState() && fresh(History) && fresh(Modifies) { - this.value := value; - this.name := name; - - History := new Types.ISimpleResourceCallHistory(); + History := new Types.IOrphanedResourceCallHistory(); Modifies := {History}; } - predicate GetResourceDataEnsuresPublicly( - input: Types.GetResourceDataInput, - output: Result + predicate OrphanedResourceOperationEnsuresPublicly( + input: Types.OrphanedResourceOperationInput, + output: Result ) {true} - method GetResourceData'( - input: Types.GetResourceDataInput + method OrphanedResourceOperation'( + input: Types.OrphanedResourceOperationInput ) returns ( - output: Result - ) + output: Result + ) requires ValidState() modifies Modifies - {History} decreases Modifies - {History} ensures && ValidState() - ensures GetResourceDataEnsuresPublicly(input, output) + ensures OrphanedResourceOperationEnsuresPublicly(input, output) ensures unchanged(History) { - var rtnString: string := if input.stringValue.Some? then - this.name + " " + input.stringValue.value - else - this.name; - var rtn: Types.GetResourceDataOutput := Types.GetResourceDataOutput( - blobValue := input.blobValue, - booleanValue := input.booleanValue, - stringValue := Some(rtnString), - integerValue := input.integerValue, - longValue := input.longValue - ); - return Success(rtn); + if ( + && input.someString.Some? + && input.someString.value == "the extern MUST provide this string to the native resource's operation" + ) { + return Success(Types.OrphanedResourceOperationOutput(someString := Some("correct string"))); + } else { + return Failure(Types.Error.OrphanedError(message := "incorrect string")); + } } } } diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy new file mode 100644 index 0000000000..972452ae77 --- /dev/null +++ b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy @@ -0,0 +1,105 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +include "../Model/SimpleOrphanedTypes.dfy" +include "OrphanedResource.dfy" + +module {:extern} SimpleOrphanedImpl refines AbstractSimpleOrphanedOperations { + import OrphanedResource + + datatype Config = Config + type InternalConfig = Config + predicate ValidInternalConfig?(config: InternalConfig) + {true} + function ModifiesInternalConfig(config: InternalConfig) : set + {{}} + predicate CreateOrphanedStructureEnsuresPublicly(input: CreateOrphanedStructureInput, output: Result) { + true + } + predicate CreateOrphanedResourceEnsuresPublicly(input: CreateOrphanedResourceInput, output: Result) { + true + } + predicate CreateOrphanedErrorEnsuresPublicly(input: CreateOrphanedErrorInput, output: Result) { + true + } + method CreateOrphanedStructure ( config: InternalConfig, input: CreateOrphanedStructureInput ) + returns (output: Result) + { + // Create Dafny OrphanedStructure. (This implicitly tests Dafny codegen's orphaned shapes generation.) + var uninitializedStructure := Types.OrphanedStructure(); + var initializedStructure := InitializeOrphanedStructure(uninitializedStructure); + + expect initializedStructure.stringValue.Some?; + expect initializedStructure.stringValue.value == "the extern MUST use Smithy-generated conversions to set this value in the native structure"; + + return Success(CreateOrphanedStructureOutput()); + } + + // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. + // This will ensure that OrphanedStructure and its conversions are generated, + // even though OrphanedStructure is "orphaned". + + // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. + // The Smithy model does not know about this operation, + // so it doesn't register OrphanedStructure as an operation shape. + // If this operation were on the Smithy model, + // both the operation and OrphanedStructure would no longer be orphaned, + // and wouldn't be useful in an "orphaned shapes" TestModel. + // Putting all usage of the orphaned shape outside the model's knowledge + // lets us test orphaned shape model/conversion generation. + method {:extern} InitializeOrphanedStructure( input: Types.OrphanedStructure ) + returns (output: Types.OrphanedStructure) + + method CreateOrphanedResource ( config: InternalConfig, input: CreateOrphanedResourceInput ) + returns (output: Result) + { + var resource := new OrphanedResource.OrphanedResource(); + var ret :- CallNativeOrphanedResource(resource); + + expect ret.someString.Some?; + expect ret.someString.value == "correct string"; + + return Success(CreateOrphanedResourceOutput()); + } + + // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. + // This will ensure that OrphanedStructure and its conversions are generated, + // even though OrphanedStructure is "orphaned". + + // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. + // The Smithy model does not know about this operation, + // so it doesn't register OrphanedStructure as an operation shape. + // If this operation were on the Smithy model, + // both the operation and OrphanedStructure would no longer be orphaned, + // and wouldn't be useful in an "orphaned shapes" TestModel. + // Putting all usage of the orphaned shape outside the model's knowledge + // lets us test orphaned shape model/conversion generation. + method {:extern} CallNativeOrphanedResource( input: OrphanedResource.OrphanedResource ) + returns (output: Result) + + method CreateOrphanedError ( config: InternalConfig, input: CreateOrphanedErrorInput ) + returns (output: Result) + { + var error := Types.Error.OrphanedError(message := "TBD"); + var out_error := CallNativeOrphanedError(error); + + expect out_error.OrphanedError?; + expect out_error.message == "the extern MUST use Smithy-generated conversions to set this value in the native error"; + + return Success(CreateOrphanedErrorOutput()); + } + + // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. + // This will ensure that OrphanedStructure and its conversions are generated, + // even though OrphanedStructure is "orphaned". + + // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. + // The Smithy model does not know about this operation, + // so it doesn't register OrphanedStructure as an operation shape. + // If this operation were on the Smithy model, + // both the operation and OrphanedStructure would no longer be orphaned, + // and wouldn't be useful in an "orphaned shapes" TestModel. + // Putting all usage of the orphaned shape outside the model's knowledge + // lets us test orphaned shape model/conversion generation. + method {:extern} CallNativeOrphanedError( input: Types.Error ) + returns (output: Types.Error ) +} \ No newline at end of file diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy deleted file mode 100644 index d02db0b1a2..0000000000 --- a/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -include "../Model/SimplePositionalTypes.dfy" -include "./SimpleResource.dfy" -module SimplePositionalImpl refines AbstractSimplePositionalOperations { - import SimpleResource - - datatype Config = Config - type InternalConfig = Config - - predicate ValidInternalConfig?(config: InternalConfig) - {true} - function ModifiesInternalConfig(config: InternalConfig): set - {{}} - predicate GetResourceEnsuresPublicly(input: GetResourceInput , output: Result) - {true} - - - - method GetResource ( config: InternalConfig , input: GetResourceInput ) - returns (output: Result) - - { - var resource := new SimpleResource.SimpleResource( - input.name - ); - var result: GetResourceOutput := GetResourceOutput( - output := resource - ); - return Success(result); - } - - - predicate GetResourcePositionalEnsuresPublicly(input: string , output: Result) - {true} - - - - // @positional allows use to accept the input parameters directly without the input structure - method GetResourcePositional ( config: InternalConfig , input: string ) - returns (output: Result) - - { - var resource := new SimpleResource.SimpleResource(input); - - // @positional allows use to return the result without the output structure - return Success(resource); - } -} diff --git a/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy new file mode 100644 index 0000000000..db9896c073 --- /dev/null +++ b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy @@ -0,0 +1,10 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +include "../Model/SimpleOrphanedTypesWrapped.dfy" + +module {:options "--function-syntax:4"} {:extern "simple.orphaned.internaldafny.wrapped"} WrappedSimpleOrphanedService refines WrappedAbstractSimpleOrphanedService { + import WrappedService = SimpleOrphaned + function WrappedDefaultSimpleOrphanedConfig(): SimpleOrphanedConfig { + SimpleOrphanedConfig + } +} diff --git a/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy b/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy deleted file mode 100644 index fb1241511d..0000000000 --- a/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -include "../src/Index.dfy" -include "./Helpers.dfy" -include "../src/MutableResource.dfy" - -module SimpleResourcesTest { - import SimpleResources - import Types = SimpleResourcesTypes - import opened Wrappers - import opened Helpers - - method TestNoneGetData( - config: Types.SimpleResourcesConfig, - resource: Types.ISimpleResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allNone(); - var result :- expect resource.GetResourceData(input); - checkMostNone(config.name, result); - } - - method TestSomeGetData( - config: Types.SimpleResourcesConfig, - resource: Types.ISimpleResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allSome(); - var output :- expect resource.GetResourceData(input); - checkSome(config.name, output); - } - - method TestGetResources( - config: Types.SimpleResourcesConfig, - client: Types.ISimpleResourcesClient - ) returns ( - resource: Types.ISimpleResource - ) - requires client.ValidState() - modifies client.Modifies - ensures client.ValidState() - ensures resource.Modifies !! {client.History} - ensures fresh(resource.Modifies - client.Modifies - {client.History} ) - ensures resource.ValidState() && fresh(resource) - { - var input := Types.GetResourcesInput( - value := Some("Test") - ); - var output :- expect client.GetResources(input); - return output.output; - } - - method TestClient(config: Types.SimpleResourcesConfig) - { - var client :- expect SimpleResources.SimpleResources(config); - var resource := TestGetResources(config, client); - TestNoneGetData(config, resource); - TestSomeGetData(config, resource); - - var mutableResource := TestGetMutableResources(config, client); - TestMutableNoneGetData(config, mutableResource); - TestMutableSomeGetData(config, mutableResource); - } - - method {:test} TestDefaultConfig() - { - TestClient(SimpleResources.DefaultSimpleResourcesConfig()); - } - - method {:test} TestCustomConfig() - { - TestClient(Types.SimpleResourcesConfig(name := "Dafny")); - } - - // This is breaking encapsulation - // this is not something for public clients to do. - // this is to access the internal state and verify that specific things are true/false. - import MutableResource = MutableResource`ForTesting - - method TestMutableNoneGetData( - config: Types.SimpleResourcesConfig, - resource: Types.IMutableResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allMutableNone(); - - expect resource is MutableResource.MutableResource; - var test:MutableResource.MutableResource := resource; - - var before := test.MyInternalState; - - var result :- expect resource.GetMutableResourceData(input); - checkMutableMostNone(config.name, result); - - // This sort of things SHOULD NOT be able to be proved. - // Dafny does not have a way to say `assert something is impossible to prove;` - // assert before != test.MyInternalState; - - // This is assuming that everything verifies - // Given that, the Dafny in MutableResource - // was able to prove MutableResource, - // and the Types file was correct - // This is a basic check to make sure - // that this simplified separated class works. - expect before + 1 == test.MyInternalState; - } - - method TestMutableSomeGetData( - config: Types.SimpleResourcesConfig, - resource: Types.IMutableResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allMutableSome(); - var output :- expect resource.GetMutableResourceData(input); - checkMutableSome(config.name, output); - } - - method TestGetMutableResources( - config: Types.SimpleResourcesConfig, - client: Types.ISimpleResourcesClient - ) returns ( - resource: Types.IMutableResource - ) - requires client.ValidState() - modifies client.Modifies - ensures client.ValidState() - ensures resource.Modifies !! {client.History} - ensures fresh(resource.Modifies - client.Modifies - {client.History} ) - ensures resource.ValidState() && fresh(resource) - { - var input := Types.GetMutableResourcesInput( - value := Some("Test") - ); - var output :- expect client.GetMutableResources(input); - return output.output; - } - -} diff --git a/TestModels/OrphanedShapes/test/WrappedTest.dfy b/TestModels/OrphanedShapes/test/WrappedTest.dfy index dbb599154b..1d478f3571 100644 --- a/TestModels/OrphanedShapes/test/WrappedTest.dfy +++ b/TestModels/OrphanedShapes/test/WrappedTest.dfy @@ -1,28 +1,48 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -include "../src/WrappedIndex.dfy" -include "./SimpleResourcesTest.dfy" +include "../src/WrappedSimpleOrphanedImpl.dfy" + +// There are no non-wrapped tests for this TestModel. +// This TestModel requires implementing externs that call Polymorph-generated code. +// Polymorph must be in the mix, even for the non-wrapped client, so it is reasonable to only have wrapped tests. module WrappedTest { - import opened SimpleResourcesTest - import WrappedSimpleResources - import opened Types = SimpleResourcesTypes - import opened Wrappers + import WrappedSimpleOrphanedService + import opened Types = SimpleOrphanedTypes - method TestWrappedClient(config: Types.SimpleResourcesConfig) + method {:test} TestWrappedClient() { - var client :- expect WrappedSimpleResources.WrappedSimpleResources(config); - var resource := TestGetResources(config, client); - TestNoneGetData(config, resource); - TestSomeGetData(config, resource); + var client :- expect WrappedSimpleOrphanedService.WrappedSimpleOrphaned(); + TestCreateOrphanedStructure(client); + TestCreateOrphanedResource(client); + TestCreateOrphanedError(client); } - - method {:test} WrappedTestDefaultConfig() { - TestWrappedClient(WrappedSimpleResources.WrappedDefaultSimpleResourcesConfig()); + + method TestCreateOrphanedStructure(client: Types.ISimpleOrphanedClient) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + { + var ret := client.CreateOrphanedStructure(Types.CreateOrphanedStructureInput); + expect ret.Success?; } - method {:test} WrappedTestCustomConfig() { - TestWrappedClient(Types.SimpleResourcesConfig(name := "Dafny")); + method TestCreateOrphanedResource(client: Types.ISimpleOrphanedClient) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + { + var ret := client.CreateOrphanedResource(Types.CreateOrphanedResourceInput); + expect ret.Success?; + } + + method TestCreateOrphanedError(client: Types.ISimpleOrphanedClient) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + { + var ret := client.CreateOrphanedError(Types.CreateOrphanedErrorInput); + expect ret.Success?; } } diff --git a/TestModels/dafny-dependencies/StandardLibrary/runtimes/net/ImplementationFromDafny-cs.dtr b/TestModels/dafny-dependencies/StandardLibrary/runtimes/net/ImplementationFromDafny-cs.dtr index 59d33d478c..6bed40cf02 100644 --- a/TestModels/dafny-dependencies/StandardLibrary/runtimes/net/ImplementationFromDafny-cs.dtr +++ b/TestModels/dafny-dependencies/StandardLibrary/runtimes/net/ImplementationFromDafny-cs.dtr @@ -1,7 +1,12 @@ file_format_version = "1.0" -dafny_version = "4.7.0.0" +dafny_version = "4.8.0.0" [options_by_module.Wrappers] +legacy-module-names = false [options_by_module."StandardLibrary.UInt"] +legacy-module-names = false [options_by_module.StandardLibrary] +legacy-module-names = false [options_by_module.UTF8] +legacy-module-names = false [options_by_module.StandardLibraryInterop] +legacy-module-names = false diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java index 17996b2c67..6c1a578cf9 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java @@ -96,6 +96,12 @@ public void baseWriteConverterForShapeAndMembers( Shape toGenerate = shapesToGenerate.remove(0); generatedShapes.add(toGenerate); + if (!shapeShouldHaveConversionFunction(toGenerate)) { + throw new IllegalArgumentException( + "Unsupported shape passed to ConversionWriter: " + toGenerate + ); + } + if (toGenerate.isStructureShape()) { writeStructureShapeConverter(toGenerate.asStructureShape().get()); } else if (toGenerate.isUnionShape()) { @@ -123,6 +129,16 @@ protected abstract void writeStringEnumShapeConverter( StringShape stringShapeWithEnumTrait ); + /** + * Returns true if a conversion function should be written for the shape, false otherwise. + * Conversion functions are only written for "complex" shapes: + * - StructureShapes ("complex" because StructureShapes can be recursive) + * - except for StructureShapes with ErrorTrait; these aren't "complex" + * - UnionShapes ("complex" because the conversion is not a one-liner) + * - EnumShapes or StringShapes with EnumTrait ("complex" because the conversion is not a one-liner) + * @param shape + * @return + */ public static boolean shapeShouldHaveConversionFunction(Shape shape) { if (shape.isStructureShape()) { if (shape.hasTrait(ErrorTrait.class)) { diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 9261218f69..2517f3e59b 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -518,16 +518,16 @@ protected void generateOrphanedShapesForService( // Neither classes nor converisons are generated for strings } else if (shapeToGenerate.isIntegerShape()) { // Neither classes nor converisons are generated for ints - continue; } else if (shapeToGenerate.isListShape()) { // Neither classes nor converisons are generated for lists - continue; } else if (shapeToGenerate.isMapShape()) { // Neither classes nor converisons are generated for maps - continue; } else if (shapeToGenerate.isLongShape()) { // Neither classes nor converisons are generated for longs - continue; + } else if (shapeToGenerate.isBlobShape()) { + // Neither classes nor converisons are generated for blobs + } else if (shapeToGenerate.isBooleanShape()) { + // Neither classes nor converisons are generated for blobs } else { // Add more as needed... throw new ClassCastException( From a73fee008a9b8035e5b52f03e6aaafa37d52b16a Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Fri, 22 Nov 2024 13:13:07 -0800 Subject: [PATCH 09/32] m --- TestModels/OrphanedShapes/Makefile | 48 ++++++ .../Model/OrphanedShapes.smithy | 46 ++++++ .../OrphanedShapes/src/OrphanedResource.dfy | 69 ++++++++ .../src/SimpleOrphanedShapesImpl.dfy | 50 ++++++ .../test/OrphanedShapesTest.dfy | 151 ++++++++++++++++++ .../OrphanedShapes/test/WrappedTest.dfy | 28 ++++ ...irectedDafnyPythonLocalServiceCodegen.java | 31 ++++ 7 files changed, 423 insertions(+) create mode 100644 TestModels/OrphanedShapes/Makefile create mode 100644 TestModels/OrphanedShapes/Model/OrphanedShapes.smithy create mode 100644 TestModels/OrphanedShapes/src/OrphanedResource.dfy create mode 100644 TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy create mode 100644 TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy create mode 100644 TestModels/OrphanedShapes/test/WrappedTest.dfy diff --git a/TestModels/OrphanedShapes/Makefile b/TestModels/OrphanedShapes/Makefile new file mode 100644 index 0000000000..b39ff14345 --- /dev/null +++ b/TestModels/OrphanedShapes/Makefile @@ -0,0 +1,48 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +CORES=2 + +ENABLE_EXTERN_PROCESSING=1 +TRANSPILE_TESTS_IN_RUST=1 + +include ../SharedMakefile.mk + +NAMESPACE=simple.positional + +PROJECT_SERVICES := \ + SimplePositional + +MAIN_SERVICE_FOR_RUST := SimplePositional + +SERVICE_NAMESPACE_SimplePositional=simple.positional + +SERVICE_DEPS_SimplePositional := + +SMITHY_DEPS=dafny-dependencies/Model/traits.smithy + +# This project has no dependencies +# DEPENDENT-MODELS:= + +POLYMORPH_OPTIONS=--generate project-files,client-constructors + +# Python + +PYTHON_MODULE_NAME=simple_positional + +TRANSLATION_RECORD_PYTHON := \ + --translation-record ../dafny-dependencies/StandardLibrary/runtimes/python/src/smithy_dafny_standard_library/internaldafny/generated/dafny_src-py.dtr + +# Constants for languages that drop extern names (Python, Go) + +TYPES_FILE_PATH=Model/SimplePositionalTypes.dfy +TYPES_FILE_WITH_EXTERN_STRING="module {:extern \"simple.positional.internaldafny.types\" } SimplePositionalTypes" +TYPES_FILE_WITHOUT_EXTERN_STRING="module SimplePositionalTypes" + +INDEX_FILE_PATH=src/Index.dfy +INDEX_FILE_WITH_EXTERN_STRING="module {:extern \"simple.positional.internaldafny\" } SimplePositional refines AbstractSimplePositionalService {" +INDEX_FILE_WITHOUT_EXTERN_STRING="module SimplePositional refines AbstractSimplePositionalService {" + +WRAPPED_INDEX_FILE_PATH=src/WrappedSimplePositionalImpl.dfy +WRAPPED_INDEX_FILE_WITH_EXTERN_STRING="module {:options \"--function-syntax:4\"} {:extern \"simple.positional.internaldafny.wrapped\"} WrappedSimplePositionalService refines WrappedAbstractSimplePositionalService {" +WRAPPED_INDEX_FILE_WITHOUT_EXTERN_STRING="module {:options \"--function-syntax:4\"} WrappedSimplePositionalService refines WrappedAbstractSimplePositionalService {" diff --git a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy new file mode 100644 index 0000000000..032adea24d --- /dev/null +++ b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy @@ -0,0 +1,46 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +$version: "2" +namespace simple.orphanedShapes + +@aws.polymorph#localService( + sdkId: "SimpleLocalService", + config: SimpleLocalServiceConfig, +) +service SimpleLocalService { + version: "2021-11-01", + resources: [], + operations: [HelloWorld, SelfReflection], + errors: [ SimpleLocalServiceException ], +} + +structure SimpleLocalServiceConfig {} + +@error("client") +structure SimpleLocalServiceException { + @required + message: String, +} + +@aws.polymorph#reference(service: SimpleLocalService) +structure SimpleLocalServiceReference {} + +operation SelfReflection { + input := { + @required + client: SimpleLocalServiceReference + } + output := { + @required + greeting: String + } +} + +operation HelloWorld { + input := { + } + output := { + @required + greeting: String + } +} \ No newline at end of file diff --git a/TestModels/OrphanedShapes/src/OrphanedResource.dfy b/TestModels/OrphanedShapes/src/OrphanedResource.dfy new file mode 100644 index 0000000000..601071bd5c --- /dev/null +++ b/TestModels/OrphanedShapes/src/OrphanedResource.dfy @@ -0,0 +1,69 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +include "../Model/SimpleResourcesTypes.dfy" + +module SimpleResource { + import opened StandardLibrary + import opened Wrappers + import Types = SimpleResourcesTypes + + class SimpleResource extends Types.ISimpleResource + { + predicate ValidState() + ensures ValidState() ==> History in Modifies + { + && History in Modifies + } + + const name: string + const value: Option + + constructor ( + value: Option, + name: string + ) + requires |name| > 0 + ensures this.value == value + ensures this.name == name + ensures ValidState() && fresh(History) && fresh(Modifies) + { + this.value := value; + this.name := name; + + History := new Types.ISimpleResourceCallHistory(); + Modifies := {History}; + } + + predicate GetResourceDataEnsuresPublicly( + input: Types.GetResourceDataInput, + output: Result + ) {true} + + method GetResourceData'( + input: Types.GetResourceDataInput + ) returns ( + output: Result + ) + requires ValidState() + modifies Modifies - {History} + decreases Modifies - {History} + ensures && ValidState() + ensures GetResourceDataEnsuresPublicly(input, output) + ensures unchanged(History) + { + var rtnString: string := if input.stringValue.Some? then + this.name + " " + input.stringValue.value + else + this.name; + var rtn: Types.GetResourceDataOutput := Types.GetResourceDataOutput( + blobValue := input.blobValue, + booleanValue := input.booleanValue, + stringValue := Some(rtnString), + integerValue := input.integerValue, + longValue := input.longValue + ); + return Success(rtn); + } + } +} diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy new file mode 100644 index 0000000000..d02db0b1a2 --- /dev/null +++ b/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy @@ -0,0 +1,50 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +include "../Model/SimplePositionalTypes.dfy" +include "./SimpleResource.dfy" +module SimplePositionalImpl refines AbstractSimplePositionalOperations { + import SimpleResource + + datatype Config = Config + type InternalConfig = Config + + predicate ValidInternalConfig?(config: InternalConfig) + {true} + function ModifiesInternalConfig(config: InternalConfig): set + {{}} + predicate GetResourceEnsuresPublicly(input: GetResourceInput , output: Result) + {true} + + + + method GetResource ( config: InternalConfig , input: GetResourceInput ) + returns (output: Result) + + { + var resource := new SimpleResource.SimpleResource( + input.name + ); + var result: GetResourceOutput := GetResourceOutput( + output := resource + ); + return Success(result); + } + + + predicate GetResourcePositionalEnsuresPublicly(input: string , output: Result) + {true} + + + + // @positional allows use to accept the input parameters directly without the input structure + method GetResourcePositional ( config: InternalConfig , input: string ) + returns (output: Result) + + { + var resource := new SimpleResource.SimpleResource(input); + + // @positional allows use to return the result without the output structure + return Success(resource); + } +} diff --git a/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy b/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy new file mode 100644 index 0000000000..fb1241511d --- /dev/null +++ b/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy @@ -0,0 +1,151 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +include "../src/Index.dfy" +include "./Helpers.dfy" +include "../src/MutableResource.dfy" + +module SimpleResourcesTest { + import SimpleResources + import Types = SimpleResourcesTypes + import opened Wrappers + import opened Helpers + + method TestNoneGetData( + config: Types.SimpleResourcesConfig, + resource: Types.ISimpleResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allNone(); + var result :- expect resource.GetResourceData(input); + checkMostNone(config.name, result); + } + + method TestSomeGetData( + config: Types.SimpleResourcesConfig, + resource: Types.ISimpleResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allSome(); + var output :- expect resource.GetResourceData(input); + checkSome(config.name, output); + } + + method TestGetResources( + config: Types.SimpleResourcesConfig, + client: Types.ISimpleResourcesClient + ) returns ( + resource: Types.ISimpleResource + ) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + ensures resource.Modifies !! {client.History} + ensures fresh(resource.Modifies - client.Modifies - {client.History} ) + ensures resource.ValidState() && fresh(resource) + { + var input := Types.GetResourcesInput( + value := Some("Test") + ); + var output :- expect client.GetResources(input); + return output.output; + } + + method TestClient(config: Types.SimpleResourcesConfig) + { + var client :- expect SimpleResources.SimpleResources(config); + var resource := TestGetResources(config, client); + TestNoneGetData(config, resource); + TestSomeGetData(config, resource); + + var mutableResource := TestGetMutableResources(config, client); + TestMutableNoneGetData(config, mutableResource); + TestMutableSomeGetData(config, mutableResource); + } + + method {:test} TestDefaultConfig() + { + TestClient(SimpleResources.DefaultSimpleResourcesConfig()); + } + + method {:test} TestCustomConfig() + { + TestClient(Types.SimpleResourcesConfig(name := "Dafny")); + } + + // This is breaking encapsulation + // this is not something for public clients to do. + // this is to access the internal state and verify that specific things are true/false. + import MutableResource = MutableResource`ForTesting + + method TestMutableNoneGetData( + config: Types.SimpleResourcesConfig, + resource: Types.IMutableResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allMutableNone(); + + expect resource is MutableResource.MutableResource; + var test:MutableResource.MutableResource := resource; + + var before := test.MyInternalState; + + var result :- expect resource.GetMutableResourceData(input); + checkMutableMostNone(config.name, result); + + // This sort of things SHOULD NOT be able to be proved. + // Dafny does not have a way to say `assert something is impossible to prove;` + // assert before != test.MyInternalState; + + // This is assuming that everything verifies + // Given that, the Dafny in MutableResource + // was able to prove MutableResource, + // and the Types file was correct + // This is a basic check to make sure + // that this simplified separated class works. + expect before + 1 == test.MyInternalState; + } + + method TestMutableSomeGetData( + config: Types.SimpleResourcesConfig, + resource: Types.IMutableResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allMutableSome(); + var output :- expect resource.GetMutableResourceData(input); + checkMutableSome(config.name, output); + } + + method TestGetMutableResources( + config: Types.SimpleResourcesConfig, + client: Types.ISimpleResourcesClient + ) returns ( + resource: Types.IMutableResource + ) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + ensures resource.Modifies !! {client.History} + ensures fresh(resource.Modifies - client.Modifies - {client.History} ) + ensures resource.ValidState() && fresh(resource) + { + var input := Types.GetMutableResourcesInput( + value := Some("Test") + ); + var output :- expect client.GetMutableResources(input); + return output.output; + } + +} diff --git a/TestModels/OrphanedShapes/test/WrappedTest.dfy b/TestModels/OrphanedShapes/test/WrappedTest.dfy new file mode 100644 index 0000000000..dbb599154b --- /dev/null +++ b/TestModels/OrphanedShapes/test/WrappedTest.dfy @@ -0,0 +1,28 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +include "../src/WrappedIndex.dfy" +include "./SimpleResourcesTest.dfy" + +module WrappedTest { + import opened SimpleResourcesTest + import WrappedSimpleResources + import opened Types = SimpleResourcesTypes + import opened Wrappers + + method TestWrappedClient(config: Types.SimpleResourcesConfig) + { + var client :- expect WrappedSimpleResources.WrappedSimpleResources(config); + var resource := TestGetResources(config, client); + TestNoneGetData(config, resource); + TestSomeGetData(config, resource); + } + + method {:test} WrappedTestDefaultConfig() { + TestWrappedClient(WrappedSimpleResources.WrappedDefaultSimpleResourcesConfig()); + } + + method {:test} WrappedTestCustomConfig() { + TestWrappedClient(Types.SimpleResourcesConfig(name := "Dafny")); + } +} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 4e3dadf6d7..29444cc09b 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -12,6 +12,8 @@ import software.amazon.polymorph.smithypython.common.nameresolver.SmithyNameResolver; import software.amazon.polymorph.smithypython.localservice.DafnyLocalServiceCodegenConstants; import software.amazon.polymorph.smithypython.localservice.customize.ReferencesFileWriter; +import software.amazon.polymorph.smithypython.localservice.shapevisitor.conversionwriter.DafnyToLocalServiceConversionFunctionWriter; +import software.amazon.polymorph.smithypython.localservice.shapevisitor.conversionwriter.LocalServiceToDafnyConversionFunctionWriter; import software.amazon.smithy.build.FileManifest; import software.amazon.smithy.codegen.core.*; import software.amazon.smithy.codegen.core.directed.*; @@ -522,6 +524,35 @@ protected void generateOrphanedShapesForService( shapeToGenerate ); } + + final WriterDelegator delegator = directive.context().writerDelegator(); + final String moduleName = + SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( + directive.context().settings().getService().getNamespace() + ); + + delegator.useFileWriter( + moduleName + "/dafny_to_smithy.py", + "", + conversionWriter -> { + DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + + delegator.useFileWriter( + moduleName + "/smithy_to_dafny.py", + "", + conversionWriter -> { + LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + } } From a30f9d9b492170b5042f0fcc1b7ed0c272ee327d Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Thu, 5 Dec 2024 11:00:43 -0800 Subject: [PATCH 10/32] java python pass --- .../__default.java | 0 .../runtimes/python/pyproject.toml | 2 +- .../__init__.py | 0 .../extern/SimpleOrphanedImpl.py | 32 +++++++++++++++++++ .../internaldafny/extern/__init__.py | 3 ++ .../extern/SimpleOrphanedShapesImpl.py | 31 ------------------ .../internaldafny/extern/__init__.py | 3 -- .../extern/wrapped_orphaned_resource.py | 7 ---- .../extern/wrapped_simple_orphaned.py | 22 +++++++++++++ .../extern/wrapped_simple_orphaned_shapes.py | 22 ------------- .../test/internaldafny/test_dafny_wrapper.py | 2 +- ...irectedDafnyPythonLocalServiceCodegen.java | 21 ++++++++---- 12 files changed, 73 insertions(+), 72 deletions(-) rename TestModels/OrphanedShapes/runtimes/java/src/main/java/{SimpleOrphanedImpl_Compile => SimpleOrphanedshapesImpl_Compile}/__default.java (100%) rename TestModels/OrphanedShapes/runtimes/python/src/{simple_orphaned_shapes => simple_orphaned}/__init__.py (100%) create mode 100644 TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/SimpleOrphanedImpl.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/__init__.py delete mode 100644 TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/SimpleOrphanedShapesImpl.py delete mode 100644 TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/__init__.py delete mode 100644 TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_orphaned_resource.py create mode 100644 TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned.py delete mode 100644 TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned_shapes.py diff --git a/TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedImpl_Compile/__default.java b/TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedshapesImpl_Compile/__default.java similarity index 100% rename from TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedImpl_Compile/__default.java rename to TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedshapesImpl_Compile/__default.java diff --git a/TestModels/OrphanedShapes/runtimes/python/pyproject.toml b/TestModels/OrphanedShapes/runtimes/python/pyproject.toml index c35aaba19a..e5bb36f547 100644 --- a/TestModels/OrphanedShapes/runtimes/python/pyproject.toml +++ b/TestModels/OrphanedShapes/runtimes/python/pyproject.toml @@ -4,7 +4,7 @@ version = "0.1.0" description = "" authors = ["AWS "] packages = [ - { include = "simple_orphaned_shapes", from = "src" } + { include = "simple_orphaned", from = "src" } ] # Include all of the following .gitignored files in package distributions, # even though it is not included in version control diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/__init__.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/__init__.py similarity index 100% rename from TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/__init__.py rename to TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/__init__.py diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/SimpleOrphanedImpl.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/SimpleOrphanedImpl.py new file mode 100644 index 0000000000..882039af44 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/SimpleOrphanedImpl.py @@ -0,0 +1,32 @@ +import simple_orphaned.internaldafny.generated.SimpleOrphanedImpl +from simple_orphaned.internaldafny.generated.SimpleOrphanedImpl import * +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers + +class default__(simple_orphaned.internaldafny.generated.SimpleOrphanedImpl.default__): + + @staticmethod + def InitializeOrphanedStructure(dafny_uninitialized_structure): + native_structure = simple_orphaned.smithygenerated.simple_orphaned.dafny_to_smithy.simple_orphaned_OrphanedStructure(dafny_uninitialized_structure) + native_structure.string_value = "the extern MUST use Smithy-generated conversions to set this value in the native structure" + dafny_initialized_structure = simple_orphaned.smithygenerated.simple_orphaned.smithy_to_dafny.simple_orphaned_OrphanedStructure(native_structure) + return dafny_initialized_structure + + @staticmethod + def CallNativeOrphanedResource(dafny_resource): + native_resource = simple_orphaned.smithygenerated.simple_orphaned.dafny_to_smithy.simple_orphaned_OrphanedResourceReference(dafny_resource) + native_output = native_resource.orphaned_resource_operation( + simple_orphaned.smithygenerated.simple_orphaned.models.OrphanedResourceOperationInput( + some_string = "the extern MUST provide this string to the native resource's operation" + ) + ) + dafny_output = simple_orphaned.smithygenerated.simple_orphaned.smithy_to_dafny.simple_orphaned_OrphanedResourceOperationOutput(native_output) + return Wrappers.Result_Success(dafny_output) + + @staticmethod + def CallNativeOrphanedError(dafny_error): + native_error = simple_orphaned.smithygenerated.simple_orphaned.deserialize._deserialize_error(dafny_error) + native_error.message = "the extern MUST use Smithy-generated conversions to set this value in the native error" + dafny_error_again = simple_orphaned.smithygenerated.simple_orphaned.errors._smithy_error_to_dafny_error(native_error) + return dafny_error_again + +simple_orphaned.internaldafny.generated.SimpleOrphanedImpl.default__ = default__ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/__init__.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/__init__.py new file mode 100644 index 0000000000..32c9026249 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/__init__.py @@ -0,0 +1,3 @@ +from . import ( + SimpleOrphanedImpl, +) \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/SimpleOrphanedShapesImpl.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/SimpleOrphanedShapesImpl.py deleted file mode 100644 index 57b9dddfcc..0000000000 --- a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/SimpleOrphanedShapesImpl.py +++ /dev/null @@ -1,31 +0,0 @@ -import simple_orphaned_shapes.internaldafny.generated.SimpleOrphanedShapesImpl -from simple_orphaned_shapes.internaldafny.generated.SimpleOrphanedShapesImpl import * - -class default__(simple_orphaned_shapes.internaldafny.generated.SimpleOrphanedShapesImpl.default__): - - @staticmethod - def InitializeOrphanedStructure(dafny_uninitialized_structure): - native_structure = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.dafny_to_smithy.simple_orphanedshapes_OrphanedStructure(dafny_uninitialized_structure) - native_structure.string_value = "the extern MUST use Smithy-generated conversions to set this value in the native structure" - dafny_initialized_structure = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.smithy_to_dafny.simple_orphanedshapes_OrphanedStructure(native_structure) - return dafny_initialized_structure - - @staticmethod - def CallNativeOrphanedResource(dafny_resource): - native_resource = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.dafny_to_smithy.simple_orphanedshapes_OrphanedResourceReference(dafny_resource) - out = native_resource.orphaned_resource_operation( - simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.models.OrphanedResourceOperationInput( - some_string = "the extern MUST provide this string to the native resource's operation" - ) - ) - dafny_resource_again = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.smithy_to_dafny.simple_orphanedshapes_OrphanedResourceReference(native_resource) - return dafny_resource_again - - @staticmethod - def CallNativeOrphanedError(dafny_error): - native_error = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.deserialize._deserialize_error(dafny_error) - native_error.message = "the extern MUST use Smithy-generated conversions to set this value in the native error" - dafny_error_again = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.errors._smithy_error_to_dafny_error(native_error) - return dafny_error_again - -simple_orphaned_shapes.internaldafny.generated.SimpleOrphanedShapesImpl.default__ = default__ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/__init__.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/__init__.py deleted file mode 100644 index 7c9af13c11..0000000000 --- a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned_shapes/internaldafny/extern/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from . import ( - SimpleOrphanedShapesImpl, -) \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_orphaned_resource.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_orphaned_resource.py deleted file mode 100644 index 41dc5910ac..0000000000 --- a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_orphaned_resource.py +++ /dev/null @@ -1,7 +0,0 @@ -from simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.references import OrphanedResource - -class default__: - @staticmethod - def WrappedResource(): - native_resource = OrphanedResource() - dafny_resource = simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.smithy_to_dafny. \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned.py new file mode 100644 index 0000000000..e5b1ac961c --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned.py @@ -0,0 +1,22 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +# src imports +from simple_orphaned.smithygenerated.simple_orphaned.client import SimpleOrphaned +from simple_orphaned.smithygenerated.simple_orphaned.shim import SimpleOrphanedShim +from simple_orphaned.smithygenerated.simple_orphaned.config import dafny_config_to_smithy_config +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers + +# test imports, not qualified since this isn't in a package +import WrappedSimpleOrphanedService + +class default__(WrappedSimpleOrphanedService.default__): + + @staticmethod + def WrappedSimpleOrphaned(config): + wrapped_config = dafny_config_to_smithy_config(config) + impl = SimpleOrphaned(wrapped_config) + wrapped_client = SimpleOrphanedShim(impl) + return Wrappers.Result_Success(wrapped_client) + +WrappedSimpleOrphanedService.default__ = default__ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned_shapes.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned_shapes.py deleted file mode 100644 index ca3c209937..0000000000 --- a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/wrapped_simple_orphaned_shapes.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 - -# src imports -from simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.client import SimpleOrphanedShapes -from simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.shim import SimpleOrphanedShapesShim -from simple_orphaned_shapes.smithygenerated.simple_orphanedshapes.config import dafny_config_to_smithy_config -import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers - -# test imports, not qualified since this isn't in a package -import WrappedSimpleOrphanedShapesService - -class default__(WrappedSimpleOrphanedShapesService.default__): - - @staticmethod - def WrappedSimpleOrphanedShapes(config): - wrapped_config = dafny_config_to_smithy_config(config) - impl = SimpleOrphanedShapes(wrapped_config) - wrapped_client = SimpleOrphanedShapesShim(impl) - return Wrappers.Result_Success(wrapped_client) - -WrappedSimpleOrphanedShapesService.default__ = default__ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py index c09393cead..7149e282b4 100644 --- a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py @@ -18,7 +18,7 @@ sys.path.append(internaldafny_dir + "/generated") # Initialize extern for test -from .extern import wrapped_simple_orphaned_shapes +from .extern import wrapped_simple_orphaned def test_dafny(): from .generated import __main__ \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index ddffa91e86..09fb4dfe62 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -515,19 +515,26 @@ protected void generateOrphanedShapesForService( directive.context() ); } else if (shapeToGenerate.isStringShape()) { - // Neither classes nor converisons are generated for strings + // Neither classes nor conversions are generated for strings + continue; } else if (shapeToGenerate.isIntegerShape()) { - // Neither classes nor converisons are generated for ints + // Neither classes nor conversions are generated for ints + continue; } else if (shapeToGenerate.isListShape()) { - // Neither classes nor converisons are generated for lists + // Neither classes nor conversions are generated for lists + continue; } else if (shapeToGenerate.isMapShape()) { - // Neither classes nor converisons are generated for maps + // Neither classes nor conversions are generated for maps + continue; } else if (shapeToGenerate.isLongShape()) { - // Neither classes nor converisons are generated for longs + // Neither classes nor conversions are generated for longs + continue; } else if (shapeToGenerate.isBlobShape()) { - // Neither classes nor converisons are generated for blobs + // Neither classes nor conversions are generated for blobs + continue; } else if (shapeToGenerate.isBooleanShape()) { - // Neither classes nor converisons are generated for blobs + // Neither classes nor conversions are generated for booleans + continue; } else { // Add more as needed... throw new ClassCastException( From b506b657d736d9e13a73a4c418a43b2eb42856bd Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Mon, 9 Dec 2024 14:05:35 -0800 Subject: [PATCH 11/32] rust --- .../Model/OrphanedShapes.smithy | 1 - .../OrphanedShapes/runtimes/rust/Cargo.toml | 22 ++ .../runtimes/rust/src/client.rs | 38 +++ .../rust/src/client/create_orphaned_error.rs | 15 + .../src/client/create_orphaned_resource.rs | 15 + .../src/client/create_orphaned_structure.rs | 15 + .../runtimes/rust/src/conversions.rs | 42 +++ .../runtimes/rust/src/conversions/client.rs | 24 ++ .../src/conversions/create_orphaned_error.rs | 7 + .../_create_orphaned_error_input.rs | 24 ++ .../_create_orphaned_error_output.rs | 24 ++ .../create_orphaned_error_input.rs | 70 +++++ .../create_orphaned_error_output.rs | 70 +++++ .../conversions/create_orphaned_resource.rs | 7 + .../_create_orphaned_resource_input.rs | 24 ++ .../_create_orphaned_resource_output.rs | 24 ++ .../create_orphaned_resource_input.rs | 70 +++++ .../create_orphaned_resource_output.rs | 70 +++++ .../conversions/create_orphaned_structure.rs | 7 + .../_create_orphaned_structure_input.rs | 24 ++ .../_create_orphaned_structure_output.rs | 24 ++ .../create_orphaned_structure_input.rs | 70 +++++ .../create_orphaned_structure_output.rs | 70 +++++ .../runtimes/rust/src/conversions/error.rs | 125 ++++++++ .../src/conversions/orphaned_config_shape.rs | 70 +++++ .../rust/src/conversions/orphaned_resource.rs | 97 +++++++ .../orphaned_resource_operation.rs | 7 + .../_orphaned_resource_operation_input.rs | 24 ++ .../_orphaned_resource_operation_output.rs | 24 ++ .../orphaned_resource_operation_input.rs | 70 +++++ .../orphaned_resource_operation_output.rs | 70 +++++ .../src/conversions/orphaned_structure.rs | 142 ++++++++++ .../rust/src/conversions/orphaned_union.rs | 37 +++ .../rust/src/conversions/orphaned_v1_enum.rs | 25 ++ .../src/conversions/simple_orphaned_config.rs | 4 + .../_simple_orphaned_config.rs | 53 ++++ .../OrphanedShapes/runtimes/rust/src/deps.rs | 3 + .../OrphanedShapes/runtimes/rust/src/error.rs | 16 ++ .../rust/src/error/sealed_unhandled.rs | 32 +++ .../runtimes/rust/src/externs.rs | 0 .../OrphanedShapes/runtimes/rust/src/lib.rs | 25 ++ .../runtimes/rust/src/operation.rs | 14 + .../src/operation/create_orphaned_error.rs | 49 ++++ .../_create_orphaned_error_input.rs | 41 +++ .../_create_orphaned_error_output.rs | 41 +++ .../create_orphaned_error/builders.rs | 65 +++++ .../src/operation/create_orphaned_resource.rs | 49 ++++ .../_create_orphaned_resource_input.rs | 41 +++ .../_create_orphaned_resource_output.rs | 41 +++ .../create_orphaned_resource/builders.rs | 65 +++++ .../operation/create_orphaned_structure.rs | 49 ++++ .../_create_orphaned_structure_input.rs | 41 +++ .../_create_orphaned_structure_output.rs | 41 +++ .../create_orphaned_structure/builders.rs | 65 +++++ .../operation/orphaned_resource_operation.rs | 35 +++ .../_orphaned_resource_operation_input.rs | 58 ++++ .../_orphaned_resource_operation_output.rs | 58 ++++ .../orphaned_resource_operation/builders.rs | 78 +++++ .../runtimes/rust/src/simple_orphaned_impl.rs | 92 ++++++ .../rust/src/standard_library_conversions.rs | 266 ++++++++++++++++++ .../rust/src/standard_library_externs.rs | 80 ++++++ .../OrphanedShapes/runtimes/rust/src/types.rs | 39 +++ .../src/types/_create_orphaned_error_input.rs | 41 +++ .../types/_create_orphaned_error_output.rs | 41 +++ .../types/_create_orphaned_resource_input.rs | 41 +++ .../types/_create_orphaned_resource_output.rs | 41 +++ .../types/_create_orphaned_structure_input.rs | 41 +++ .../_create_orphaned_structure_output.rs | 41 +++ .../rust/src/types/_orphaned_config_shape.rs | 58 ++++ .../_orphaned_resource_operation_input.rs | 58 ++++ .../_orphaned_resource_operation_output.rs | 58 ++++ .../rust/src/types/_orphaned_structure.rs | 234 +++++++++++++++ .../rust/src/types/_orphaned_union.rs | 53 ++++ .../rust/src/types/_orphaned_v1_enum.rs | 20 ++ .../runtimes/rust/src/types/builders.rs | 22 ++ .../runtimes/rust/src/types/error.rs | 72 +++++ .../rust/src/types/orphaned_resource.rs | 40 +++ .../orphaned_resource_operation.rs | 15 + .../rust/src/types/simple_orphaned_config.rs | 58 ++++ .../runtimes/rust/src/wrapped.rs | 15 + .../runtimes/rust/src/wrapped/client.rs | 140 +++++++++ .../OrphanedShapes/src/SimpleOrphanedImpl.dfy | 2 +- .../test/OrphanedShapesTest.dfy | 151 ---------- 83 files changed, 3978 insertions(+), 153 deletions(-) create mode 100644 TestModels/OrphanedShapes/runtimes/rust/Cargo.toml create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/client.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_error.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_resource.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_structure.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/client.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/error.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_config_shape.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_structure.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_union.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_v1_enum.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config/_simple_orphaned_config.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/deps.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/error.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/error/sealed_unhandled.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/externs.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/lib.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/builders.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/builders.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/builders.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/builders.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/simple_orphaned_impl.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_config_shape.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_input.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_output.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_structure.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_union.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_v1_enum.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/builders.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/error.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource/orphaned_resource_operation.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/simple_orphaned_config.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/wrapped.rs create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs delete mode 100644 TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy diff --git a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy index 503ffe13b3..4fa851bc3d 100644 --- a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy +++ b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy @@ -94,7 +94,6 @@ structure OrphanedStructure { // bigDecimalValue: OrphanedBigDecimal, // timestampValue: OrphanedTimestamp, unionValue: OrphanedUnion, - structureValue: OrphanedStructure, enumValue: OrphanedV1Enum, mapValue: OrphanedMap, listValue: OrphanedList diff --git a/TestModels/OrphanedShapes/runtimes/rust/Cargo.toml b/TestModels/OrphanedShapes/runtimes/rust/Cargo.toml new file mode 100644 index 0000000000..45c7f4805a --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "simple_orphaned" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[features] +wrapped-client = [] + +[dependencies] +aws-smithy-runtime = {version = "1.6.0", features = ["client"] } +aws-smithy-runtime-api = {version = "1.7.0", features = ["client"] } +aws-smithy-types = "1.2.0" +dafny_runtime = { path = "../../../dafny-dependencies/dafny_runtime_rust"} + +[dev-dependencies] +simple_orphaned = { path = ".", features = ["wrapped-client"] } + +[dependencies.tokio] +version = "1.26.0" +features = ["full"] diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/client.rs b/TestModels/OrphanedShapes/runtimes/rust/src/client.rs new file mode 100644 index 0000000000..40a2417d26 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/client.rs @@ -0,0 +1,38 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use aws_smithy_types::error::operation::BuildError; + +#[derive(::std::clone::Clone, ::std::fmt::Debug, ::std::cmp::PartialEq)] +#[allow(missing_docs)] +pub struct Client { + pub(crate) dafny_client: ::dafny_runtime::Object +} + +impl Client { + /// Creates a new client from the service [`Config`](crate::Config). + #[track_caller] + pub fn from_conf( + conf: crate::types::simple_orphaned_config::SimpleOrphanedConfig, + ) -> Result { + let inner = + crate::simple::orphaned::internaldafny::_default::SimpleOrphaned( + &crate::conversions::simple_orphaned_config::_simple_orphaned_config::to_dafny(conf), + ); + if matches!( + inner.as_ref(), + crate::_Wrappers_Compile::Result::Failure { .. } + ) { + return Err(crate::conversions::error::from_dafny(inner.as_ref().error().clone())); + } + Ok(Self { + dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) + }) + } +} + +mod create_orphaned_structure; + +mod create_orphaned_resource; + +mod create_orphaned_error; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_error.rs new file mode 100644 index 0000000000..0ecd2537f5 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_error.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +impl crate::client::Client { + /// Constructs a fluent builder for the [`CreateOrphanedError`](crate::operation::create_orphaned_error::builders::CreateOrphanedErrorFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + + /// - On success, responds with [`CreateOrphanedErrorOutput`](crate::operation::create_orphaned_error::CreateOrphanedErrorOutput) with field(s): + + /// - On failure, responds with [`SdkError`](crate::operation::create_orphaned_error::CreateOrphanedErrorError) + pub fn create_orphaned_error(&self) -> crate::operation::create_orphaned_error::builders::CreateOrphanedErrorFluentBuilder { + crate::operation::create_orphaned_error::builders::CreateOrphanedErrorFluentBuilder::new(self.clone()) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_resource.rs new file mode 100644 index 0000000000..9876da1e1f --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_resource.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +impl crate::client::Client { + /// Constructs a fluent builder for the [`CreateOrphanedResource`](crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + + /// - On success, responds with [`CreateOrphanedResourceOutput`](crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput) with field(s): + + /// - On failure, responds with [`SdkError`](crate::operation::create_orphaned_resource::CreateOrphanedResourceError) + pub fn create_orphaned_resource(&self) -> crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceFluentBuilder { + crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceFluentBuilder::new(self.clone()) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_structure.rs new file mode 100644 index 0000000000..a6bf6ac2c7 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_structure.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +impl crate::client::Client { + /// Constructs a fluent builder for the [`CreateOrphanedStructure`](crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + + /// - On success, responds with [`CreateOrphanedStructureOutput`](crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput) with field(s): + + /// - On failure, responds with [`SdkError`](crate::operation::create_orphaned_structure::CreateOrphanedStructureError) + pub fn create_orphaned_structure(&self) -> crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureFluentBuilder { + crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureFluentBuilder::new(self.clone()) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions.rs new file mode 100644 index 0000000000..be8fdf0fc9 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions.rs @@ -0,0 +1,42 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + + pub mod create_orphaned_error; + + pub mod create_orphaned_error_input; + + pub mod create_orphaned_error_output; + + pub mod create_orphaned_resource; + + pub mod create_orphaned_resource_input; + + pub mod create_orphaned_resource_output; + + pub mod create_orphaned_structure; + + pub mod create_orphaned_structure_input; + + pub mod create_orphaned_structure_output; + + pub mod error; + + pub mod orphaned_config_shape; + + pub mod orphaned_resource; + + pub mod orphaned_resource_operation; + + pub mod orphaned_resource_operation_input; + + pub mod orphaned_resource_operation_output; + + pub mod orphaned_structure; + + pub mod orphaned_union; + + pub mod orphaned_v1_enum; + +pub mod simple_orphaned_config; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/client.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/client.rs new file mode 100644 index 0000000000..513bf744c2 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/client.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] + +pub fn to_dafny( + value: &crate::client::Client, +) -> + ::dafny_runtime::Object +{ + value.dafny_client.clone() +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::dafny_runtime::Object< + dyn crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient + >, +) -> crate::client::Client { + crate::client::Client { dafny_client: dafny_value } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error.rs new file mode 100644 index 0000000000..ddde98d7c6 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error.rs @@ -0,0 +1,7 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + + pub mod _create_orphaned_error_input; + + pub mod _create_orphaned_error_output; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_input.rs new file mode 100644 index 0000000000..cd272b4bd8 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_input.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::create_orphaned_error::CreateOrphanedErrorInput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, +>{ + ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput::CreateOrphanedErrorInput { + + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, + >, +) -> crate::operation::create_orphaned_error::CreateOrphanedErrorInput { + crate::operation::create_orphaned_error::CreateOrphanedErrorInput::builder() + + .build() + .unwrap() +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_output.rs new file mode 100644 index 0000000000..9bd9cc52e4 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_output.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, +>{ + ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput::CreateOrphanedErrorOutput { + + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, + >, +) -> crate::operation::create_orphaned_error::CreateOrphanedErrorOutput { + crate::operation::create_orphaned_error::CreateOrphanedErrorOutput::builder() + + .build() + .unwrap() +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_input.rs new file mode 100644 index 0000000000..b9b58f85f6 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_input.rs @@ -0,0 +1,70 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::CreateOrphanedErrorInput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::CreateOrphanedErrorInput, +) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput::CreateOrphanedErrorInput { + + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, + >, +) -> crate::types::CreateOrphanedErrorInput { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, +) -> crate::types::CreateOrphanedErrorInput { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput::CreateOrphanedErrorInput {..} => + crate::types::CreateOrphanedErrorInput::builder() + + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_output.rs new file mode 100644 index 0000000000..1907c7d6bc --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_output.rs @@ -0,0 +1,70 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::CreateOrphanedErrorOutput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::CreateOrphanedErrorOutput, +) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput::CreateOrphanedErrorOutput { + + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, + >, +) -> crate::types::CreateOrphanedErrorOutput { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, +) -> crate::types::CreateOrphanedErrorOutput { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput::CreateOrphanedErrorOutput {..} => + crate::types::CreateOrphanedErrorOutput::builder() + + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource.rs new file mode 100644 index 0000000000..58684780b4 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource.rs @@ -0,0 +1,7 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + + pub mod _create_orphaned_resource_input; + + pub mod _create_orphaned_resource_output; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_input.rs new file mode 100644 index 0000000000..a83c094be3 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_input.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::create_orphaned_resource::CreateOrphanedResourceInput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, +>{ + ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput::CreateOrphanedResourceInput { + + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, + >, +) -> crate::operation::create_orphaned_resource::CreateOrphanedResourceInput { + crate::operation::create_orphaned_resource::CreateOrphanedResourceInput::builder() + + .build() + .unwrap() +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_output.rs new file mode 100644 index 0000000000..5dd75dd331 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_output.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, +>{ + ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput::CreateOrphanedResourceOutput { + + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, + >, +) -> crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput { + crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput::builder() + + .build() + .unwrap() +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_input.rs new file mode 100644 index 0000000000..98cf0ff360 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_input.rs @@ -0,0 +1,70 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::CreateOrphanedResourceInput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::CreateOrphanedResourceInput, +) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput::CreateOrphanedResourceInput { + + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, + >, +) -> crate::types::CreateOrphanedResourceInput { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, +) -> crate::types::CreateOrphanedResourceInput { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput::CreateOrphanedResourceInput {..} => + crate::types::CreateOrphanedResourceInput::builder() + + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_output.rs new file mode 100644 index 0000000000..87c8b7dfac --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_output.rs @@ -0,0 +1,70 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::CreateOrphanedResourceOutput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::CreateOrphanedResourceOutput, +) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput::CreateOrphanedResourceOutput { + + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, + >, +) -> crate::types::CreateOrphanedResourceOutput { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, +) -> crate::types::CreateOrphanedResourceOutput { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput::CreateOrphanedResourceOutput {..} => + crate::types::CreateOrphanedResourceOutput::builder() + + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure.rs new file mode 100644 index 0000000000..578ae4695c --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure.rs @@ -0,0 +1,7 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + + pub mod _create_orphaned_structure_input; + + pub mod _create_orphaned_structure_output; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_input.rs new file mode 100644 index 0000000000..1a6cb24bd7 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_input.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::create_orphaned_structure::CreateOrphanedStructureInput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, +>{ + ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput::CreateOrphanedStructureInput { + + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, + >, +) -> crate::operation::create_orphaned_structure::CreateOrphanedStructureInput { + crate::operation::create_orphaned_structure::CreateOrphanedStructureInput::builder() + + .build() + .unwrap() +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_output.rs new file mode 100644 index 0000000000..cd61f8a368 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_output.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, +>{ + ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput::CreateOrphanedStructureOutput { + + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, + >, +) -> crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput { + crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput::builder() + + .build() + .unwrap() +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_input.rs new file mode 100644 index 0000000000..8431526c70 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_input.rs @@ -0,0 +1,70 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::CreateOrphanedStructureInput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::CreateOrphanedStructureInput, +) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput::CreateOrphanedStructureInput { + + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, + >, +) -> crate::types::CreateOrphanedStructureInput { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, +) -> crate::types::CreateOrphanedStructureInput { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput::CreateOrphanedStructureInput {..} => + crate::types::CreateOrphanedStructureInput::builder() + + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_output.rs new file mode 100644 index 0000000000..6184784382 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_output.rs @@ -0,0 +1,70 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::CreateOrphanedStructureOutput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::CreateOrphanedStructureOutput, +) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput::CreateOrphanedStructureOutput { + + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, + >, +) -> crate::types::CreateOrphanedStructureOutput { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, +) -> crate::types::CreateOrphanedStructureOutput { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput::CreateOrphanedStructureOutput {..} => + crate::types::CreateOrphanedStructureOutput::builder() + + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/error.rs new file mode 100644 index 0000000000..2461c87937 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/error.rs @@ -0,0 +1,125 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Wraps up an arbitrary Rust Error value as a Dafny Error +pub fn to_opaque_error(value: String) -> + ::std::rc::Rc +{ + let error_msg = value.clone(); + let error_msg = ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&error_msg); + let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( + ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), + )); + ::std::rc::Rc::new( + crate::r#simple::orphaned::internaldafny::types::Error::OpaqueWithText { + obj: error_obj, + objMessage: error_msg + }, + ) +} + +/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure +pub fn to_opaque_error_result(value: String) -> + ::std::rc::Rc< + crate::_Wrappers_Compile::Result< + T, + ::std::rc::Rc + > + > +{ + ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: to_opaque_error(value), + }) +} +pub fn to_dafny( + value: crate::types::error::Error, +) -> ::std::rc::Rc { + ::std::rc::Rc::new(match value { + crate::types::error::Error::OrphanedError { message } => + crate::r#simple::orphaned::internaldafny::types::Error::OrphanedError { + message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&message), + }, + crate::types::error::Error::CollectionOfErrors { list, message } => + crate::r#simple::orphaned::internaldafny::types::Error::CollectionOfErrors { + message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&message), + list: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&list, |e| to_dafny(e.clone())) + }, + crate::types::error::Error::ValidationError(inner) => + crate::r#simple::orphaned::internaldafny::types::Error::Opaque { + obj: { + let rc = ::std::rc::Rc::new(inner) as ::std::rc::Rc; + // safety: `rc` is new, ensuring it has refcount 1 and is uniquely owned. + // we should use `dafny_runtime_conversions::rc_struct_to_dafny_class` once it + // accepts unsized types (https://github.com/dafny-lang/dafny/pull/5769) + unsafe { ::dafny_runtime::Object::from_rc(rc) } + }, + }, + crate::types::error::Error::Opaque { obj } => + crate::r#simple::orphaned::internaldafny::types::Error::Opaque { + obj: ::dafny_runtime::Object(obj.0) + }, + crate::types::error::Error::OpaqueWithText { obj, objMessage } => + crate::r#simple::orphaned::internaldafny::types::Error::OpaqueWithText { + obj: ::dafny_runtime::Object(obj.0), + objMessage: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&objMessage), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::Error, + >, +) -> crate::types::error::Error { + match ::std::borrow::Borrow::borrow(&dafny_value) { + crate::r#simple::orphaned::internaldafny::types::Error::OrphanedError { message } => + crate::types::error::Error::OrphanedError { + message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&message), + }, + crate::r#simple::orphaned::internaldafny::types::Error::CollectionOfErrors { list, message } => + crate::types::error::Error::CollectionOfErrors { + message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&message), + list: ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&list, |e| from_dafny(e.clone())) + }, + crate::r#simple::orphaned::internaldafny::types::Error::Opaque { obj } => + crate::types::error::Error::Opaque { + obj: obj.clone() + }, + crate::r#simple::orphaned::internaldafny::types::Error::Opaque { obj } => + { + use ::std::any::Any; + if ::dafny_runtime::is_object!(obj, crate::types::error::ValidationError) { + let typed = ::dafny_runtime::cast_object!(obj.clone(), crate::types::error::ValidationError); + crate::types::error::Error::ValidationError( + // safety: dafny_class_to_struct will increment ValidationError's Rc + unsafe { + ::dafny_runtime::dafny_runtime_conversions::object::dafny_class_to_struct(typed) + } + ) + } else { + crate::types::error::Error::Opaque { + obj: obj.clone() + } + } + }, + crate::r#simple::orphaned::internaldafny::types::Error::OpaqueWithText { obj, objMessage } => + { + use ::std::any::Any; + if ::dafny_runtime::is_object!(obj, crate::types::error::ValidationError) { + let typed = ::dafny_runtime::cast_object!(obj.clone(), crate::types::error::ValidationError); + crate::types::error::Error::ValidationError( + // safety: dafny_class_to_struct will increment ValidationError's Rc + unsafe { + ::dafny_runtime::dafny_runtime_conversions::object::dafny_class_to_struct(typed) + } + ) + } else { + crate::types::error::Error::OpaqueWithText { + obj: obj.clone(), + objMessage: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&objMessage), + } + } + }, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_config_shape.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_config_shape.rs new file mode 100644 index 0000000000..2e598d4fe9 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_config_shape.rs @@ -0,0 +1,70 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::OrphanedConfigShape, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::OrphanedConfigShape, +) -> crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape { + crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape::OrphanedConfigShape { + stringMember: crate::standard_library_conversions::ostring_to_dafny(&value.string_member), + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape, + >, +) -> crate::types::OrphanedConfigShape { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape, +) -> crate::types::OrphanedConfigShape { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape::OrphanedConfigShape {..} => + crate::types::OrphanedConfigShape::builder() + .set_string_member(crate::standard_library_conversions::ostring_from_dafny(dafny_value.stringMember().clone())) + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource.rs new file mode 100644 index 0000000000..bb01660838 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource.rs @@ -0,0 +1,97 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::orphaned_resource::OrphanedResourceRef, +) -> ::dafny_runtime::Object< + dyn crate::r#simple::orphaned::internaldafny::types::IOrphanedResource, +> { + let wrap = OrphanedResourceWrapper { + obj: value.clone(), + }; + let inner = ::std::rc::Rc::new(::std::cell::UnsafeCell::new(wrap)); + ::dafny_runtime::Object (Some(inner) ) +} + +pub struct OrphanedResourceWrapper { + obj: crate::types::orphaned_resource::OrphanedResourceRef, +} + +impl ::dafny_runtime::UpcastObject for OrphanedResourceWrapper { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::dafny_runtime::Object< + dyn crate::r#simple::orphaned::internaldafny::types::IOrphanedResource, + >, +) -> crate::types::orphaned_resource::OrphanedResourceRef { + let wrap = IOrphanedResourceDafnyWrapper { + obj: dafny_value.clone(), + }; + crate::types::orphaned_resource::OrphanedResourceRef { + inner: ::std::rc::Rc::new(::std::cell::RefCell::new(wrap)) + } +} + +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct IOrphanedResourceDafnyWrapper { + pub(crate) obj: ::dafny_runtime::Object< + dyn crate::r#simple::orphaned::internaldafny::types::IOrphanedResource, + >, +} + +impl crate::simple::orphaned::internaldafny::types::IOrphanedResource + for OrphanedResourceWrapper +{ + fn r#_OrphanedResourceOperation_k( + &self, + input: &::std::rc::Rc, +) -> ::std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + ::std::rc::Rc, + ::std::rc::Rc, + >, +> +{ + let inner_input = crate::conversions::orphaned_resource_operation::_orphaned_resource_operation_input::from_dafny(input.clone()); + let inner_result = self.obj.inner.borrow_mut().orphaned_resource_operation(inner_input); + let result = match inner_result { + Ok(x) => crate::r#_Wrappers_Compile::Result::Success { + value: crate::conversions::orphaned_resource_operation::_orphaned_resource_operation_output::to_dafny(x.clone()), + }, + Err(x) => crate::r#_Wrappers_Compile::Result::Failure { + error: crate::conversions::error::to_dafny(x), + }, + }; + ::std::rc::Rc::new(result) +} +} + +impl crate::types::orphaned_resource::OrphanedResource for IOrphanedResourceDafnyWrapper +{ + fn orphaned_resource_operation( + &self, + input: crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, +) -> Result< + crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, + crate::types::error::Error, +> { + let inner_input = crate::conversions::orphaned_resource_operation::_orphaned_resource_operation_input::to_dafny(input); + let inner_result = ::dafny_runtime::md!(self.obj.clone()).OrphanedResourceOperation(&inner_input); + if matches!( + inner_result.as_ref(), + crate::r#_Wrappers_Compile::Result::Success { .. } + ) { + Ok( + crate::conversions::orphaned_resource_operation::_orphaned_resource_operation_output::from_dafny(inner_result.value().clone()), + ) + } else { + Err(crate::conversions::error::from_dafny( + inner_result.error().clone(), + )) + } +} +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation.rs new file mode 100644 index 0000000000..1ba99a12ab --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation.rs @@ -0,0 +1,7 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + + pub mod _orphaned_resource_operation_input; + + pub mod _orphaned_resource_operation_output; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_input.rs new file mode 100644 index 0000000000..d6f3b6eae6 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_input.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, +>{ + ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput::OrphanedResourceOperationInput { + someString: crate::standard_library_conversions::ostring_to_dafny(&value.some_string), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, + >, +) -> crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput { + crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput::builder() + .set_some_string(crate::standard_library_conversions::ostring_from_dafny(dafny_value.someString().clone())) + .build() + .unwrap() +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_output.rs new file mode 100644 index 0000000000..9813cb2894 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_output.rs @@ -0,0 +1,24 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, +>{ + ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput::OrphanedResourceOperationOutput { + someString: crate::standard_library_conversions::ostring_to_dafny(&value.some_string), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, + >, +) -> crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput { + crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput::builder() + .set_some_string(crate::standard_library_conversions::ostring_from_dafny(dafny_value.someString().clone())) + .build() + .unwrap() +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_input.rs new file mode 100644 index 0000000000..72c49a9938 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_input.rs @@ -0,0 +1,70 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::OrphanedResourceOperationInput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::OrphanedResourceOperationInput, +) -> crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput { + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput::OrphanedResourceOperationInput { + someString: crate::standard_library_conversions::ostring_to_dafny(&value.some_string), + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, + >, +) -> crate::types::OrphanedResourceOperationInput { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, +) -> crate::types::OrphanedResourceOperationInput { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput::OrphanedResourceOperationInput {..} => + crate::types::OrphanedResourceOperationInput::builder() + .set_some_string(crate::standard_library_conversions::ostring_from_dafny(dafny_value.someString().clone())) + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_output.rs new file mode 100644 index 0000000000..eb02ad6a7b --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_output.rs @@ -0,0 +1,70 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::OrphanedResourceOperationOutput, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::OrphanedResourceOperationOutput, +) -> crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput { + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput::OrphanedResourceOperationOutput { + someString: crate::standard_library_conversions::ostring_to_dafny(&value.some_string), + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, + >, +) -> crate::types::OrphanedResourceOperationOutput { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, +) -> crate::types::OrphanedResourceOperationOutput { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput::OrphanedResourceOperationOutput {..} => + crate::types::OrphanedResourceOperationOutput::builder() + .set_some_string(crate::standard_library_conversions::ostring_from_dafny(dafny_value.someString().clone())) + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_structure.rs new file mode 100644 index 0000000000..8b4751fd40 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_structure.rs @@ -0,0 +1,142 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::OrphanedStructure, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedStructure, +> { + ::std::rc::Rc::new(to_dafny_plain(value.clone())) +} + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::OrphanedStructure, +) -> crate::r#simple::orphaned::internaldafny::types::OrphanedStructure { + crate::r#simple::orphaned::internaldafny::types::OrphanedStructure::OrphanedStructure { + blobValue: crate::standard_library_conversions::oblob_to_dafny(&value.blob_value), + booleanValue: crate::standard_library_conversions::obool_to_dafny(&value.boolean_value), + stringValue: crate::standard_library_conversions::ostring_to_dafny(&value.string_value), + integerValue: crate::standard_library_conversions::oint_to_dafny(value.integer_value), + longValue: crate::standard_library_conversions::olong_to_dafny(&value.long_value), + unionValue: ::std::rc::Rc::new(match &value.union_value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::orphaned_union::to_dafny(&x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + enumValue: ::std::rc::Rc::new(match &value.enum_value { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::orphaned_v1_enum::to_dafny(x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + mapValue: +::std::rc::Rc::new(match &value.map_value { + Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : + ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, + |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), + |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), + ) + }, + None => crate::r#_Wrappers_Compile::Option::None {} +}) +, + listValue: ::std::rc::Rc::new(match &value.list_value { + Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, + |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), + ) + }, + None => crate::r#_Wrappers_Compile::Option::None {} +}) +, + } +} + +#[allow(dead_code)] +pub fn option_to_dafny( + value: ::std::option::Option, +) -> ::std::rc::Rc>>{ + ::std::rc::Rc::new(match value { + ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, + ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { + value: ::std::rc::Rc::new(to_dafny_plain(x)), + }, + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedStructure, + >, +) -> crate::types::OrphanedStructure { + plain_from_dafny(&*dafny_value) +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedStructure, +) -> crate::types::OrphanedStructure { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::OrphanedStructure::OrphanedStructure {..} => + crate::types::OrphanedStructure::builder() + .set_blob_value(crate::standard_library_conversions::oblob_from_dafny(dafny_value.blobValue().clone())) + .set_boolean_value(crate::standard_library_conversions::obool_from_dafny(dafny_value.booleanValue().clone())) + .set_string_value(crate::standard_library_conversions::ostring_from_dafny(dafny_value.stringValue().clone())) + .set_integer_value(crate::standard_library_conversions::oint_from_dafny(dafny_value.integerValue().clone())) + .set_long_value(crate::standard_library_conversions::olong_from_dafny(dafny_value.longValue().clone())) + .set_union_value(match (*dafny_value.unionValue()).as_ref() { + crate::r#_Wrappers_Compile::Option::Some { value } => + Some(crate::conversions::orphaned_union::from_dafny(value.clone())), + _ => None, +} +) + .set_enum_value(match &**dafny_value.enumValue() { + crate::r#_Wrappers_Compile::Option::Some { value } => Some( + crate::conversions::orphaned_v1_enum::from_dafny(value) + ), + _ => None, +} +) + .set_map_value(match (*dafny_value.mapValue()).as_ref() { + crate::r#_Wrappers_Compile::Option::Some { value } => + Some( + ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, + |k: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<::dafny_runtime::dafny_runtime_conversions::DafnyCharUTF16>| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), + |v: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<::dafny_runtime::dafny_runtime_conversions::DafnyCharUTF16>| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), + ) + ), + _ => None +} +) + .set_list_value(match (*dafny_value.listValue()).as_ref() { + crate::r#_Wrappers_Compile::Option::Some { value } => + Some( + ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, + |e: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<::dafny_runtime::dafny_runtime_conversions::DafnyCharUTF16>| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), + ) + ), + _ => None +} +) + .build() + .unwrap() + } +} + +#[allow(dead_code)] +pub fn option_from_dafny( + dafny_value: ::std::rc::Rc>>, +) -> ::std::option::Option { + match &*dafny_value { + crate::_Wrappers_Compile::Option::Some { value } => { + ::std::option::Option::Some(plain_from_dafny(value)) + } + _ => ::std::option::Option::None, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_union.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_union.rs new file mode 100644 index 0000000000..fdcdfaf4d0 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_union.rs @@ -0,0 +1,37 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] +pub fn to_dafny( + value: &crate::types::OrphanedUnion, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedUnion, +> { + ::std::rc::Rc::new(match value { + crate::types::OrphanedUnion::IntegerValue(x) => + crate::r#simple::orphaned::internaldafny::types::OrphanedUnion::integerValue { + integerValue: x.clone(), + }, +crate::types::OrphanedUnion::StringValue(x) => + crate::r#simple::orphaned::internaldafny::types::OrphanedUnion::stringValue { + stringValue: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&x), + }, + _ => panic!("Unknown union variant: {:?}", value), + }) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::OrphanedUnion, + >, +) -> crate::types::OrphanedUnion { + match &::std::rc::Rc::unwrap_or_clone(dafny_value) { + crate::r#simple::orphaned::internaldafny::types::OrphanedUnion::integerValue { + integerValue: x @ _, +} => crate::types::OrphanedUnion::IntegerValue(x .clone()), +crate::r#simple::orphaned::internaldafny::types::OrphanedUnion::stringValue { + stringValue: x @ _, +} => crate::types::OrphanedUnion::StringValue(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(x)), + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_v1_enum.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_v1_enum.rs new file mode 100644 index 0000000000..15f4394e93 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_v1_enum.rs @@ -0,0 +1,25 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] + +pub fn to_dafny( + value: crate::types::OrphanedV1Enum, +) -> ::std::rc::Rc{ + ::std::rc::Rc::new(match value { + crate::types::OrphanedV1Enum::First => crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::FIRST {}, +crate::types::OrphanedV1Enum::Second => crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::SECOND {}, +crate::types::OrphanedV1Enum::Third => crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::THIRD {}, + _ => panic!("Unknown enum variant: {}", value), + }) +} + #[allow(dead_code)] +pub fn from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum, +) -> crate::types::OrphanedV1Enum { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::FIRST {} => crate::types::OrphanedV1Enum::First, +crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::SECOND {} => crate::types::OrphanedV1Enum::Second, +crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::THIRD {} => crate::types::OrphanedV1Enum::Third, + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config.rs new file mode 100644 index 0000000000..ea2cf596ac --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config.rs @@ -0,0 +1,4 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod _simple_orphaned_config; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config/_simple_orphaned_config.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config/_simple_orphaned_config.rs new file mode 100644 index 0000000000..9fc2718339 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config/_simple_orphaned_config.rs @@ -0,0 +1,53 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[allow(dead_code)] + +pub fn to_dafny( + value: crate::types::simple_orphaned_config::SimpleOrphanedConfig, +) -> ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, +> { + ::std::rc::Rc::new(to_dafny_plain(value)) +} + +#[allow(dead_code)] +pub fn from_dafny( + dafny_value: ::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, + >, +) -> crate::types::simple_orphaned_config::SimpleOrphanedConfig { + plain_from_dafny(&*dafny_value) +} + + +#[allow(dead_code)] +pub fn to_dafny_plain( + value: crate::types::simple_orphaned_config::SimpleOrphanedConfig, +) -> crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig { + crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig::SimpleOrphanedConfig { + structureMember: ::std::rc::Rc::new(match &value.structure_member { + Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::orphaned_config_shape::to_dafny(&x.clone()) }, + None => crate::_Wrappers_Compile::Option::None { } +}) +, + } +} + +#[allow(dead_code)] +pub fn plain_from_dafny( + dafny_value: &crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, +) -> crate::types::simple_orphaned_config::SimpleOrphanedConfig { + match dafny_value { + crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig::SimpleOrphanedConfig {..} => + crate::types::simple_orphaned_config::SimpleOrphanedConfig::builder() + .set_structure_member(match (*dafny_value.structureMember()).as_ref() { + crate::r#_Wrappers_Compile::Option::Some { value } => + Some(crate::conversions::orphaned_config_shape::from_dafny(value.clone())), + _ => None, +} +) + .build() + .unwrap() + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/deps.rs b/TestModels/OrphanedShapes/runtimes/rust/src/deps.rs new file mode 100644 index 0000000000..5fbbbaa0f8 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/deps.rs @@ -0,0 +1,3 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/error.rs new file mode 100644 index 0000000000..4cddaa7c39 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/error.rs @@ -0,0 +1,16 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use ::aws_smithy_runtime_api::box_error::BoxError; + +/// Error type returned by the client. +pub type SdkError = + ::aws_smithy_runtime_api::client::result::SdkError; +pub use ::aws_smithy_runtime_api::client::result::ConnectorError; +pub use ::aws_smithy_types::error::operation::BuildError; + +pub use ::aws_smithy_types::error::display::DisplayErrorContext; +pub use ::aws_smithy_types::error::metadata::ErrorMetadata; +pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; + +pub(crate) mod sealed_unhandled; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/OrphanedShapes/runtimes/rust/src/error/sealed_unhandled.rs new file mode 100644 index 0000000000..eae8007292 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/error/sealed_unhandled.rs @@ -0,0 +1,32 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::any::Any; + +use dafny_runtime::UpcastObject; + +/// This struct is not intended to be used. +/// +/// This struct holds information about an unhandled error, +/// but that information should be obtained by using the +/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait +/// on the error type. +/// +/// This struct intentionally doesn't yield any useful information itself. +#[deprecated( + note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ +variable wildcard pattern and check `.code()`: + \ +   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ +See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." +)] +#[derive(Debug)] +pub struct Unhandled { + pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, + pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, +} + +impl UpcastObject for Unhandled { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/externs.rs b/TestModels/OrphanedShapes/runtimes/rust/src/externs.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs b/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs new file mode 100644 index 0000000000..a54dfeafad --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs @@ -0,0 +1,25 @@ +#![allow( + deprecated, + non_upper_case_globals, + unused, + non_snake_case, + non_camel_case_types +)] + +pub mod client; +pub mod conversions; +pub mod deps; +/// Common errors and error handling utilities. +pub mod error; +pub(crate) mod implementation_from_dafny; +/// All operations that this crate can perform. +pub mod operation; +mod standard_library_conversions; +mod standard_library_externs; +pub mod types; +pub mod wrapped; +pub mod simple_orphaned_impl; +pub(crate) use crate::implementation_from_dafny::r#_Wrappers_Compile; +pub(crate) use crate::implementation_from_dafny::simple; +pub use crate::types::simple_orphaned_config::SimpleOrphanedConfig; +pub use client::Client; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation.rs new file mode 100644 index 0000000000..d091a3fa4f --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation.rs @@ -0,0 +1,14 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Types for the `CreateOrphanedError` operation. +pub mod create_orphaned_error; + +/// Types for the `CreateOrphanedResource` operation. +pub mod create_orphaned_resource; + +/// Types for the `CreateOrphanedStructure` operation. +pub mod create_orphaned_structure; + +/// Types for the `OrphanedResourceOperation` operation. +pub mod orphaned_resource_operation; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error.rs new file mode 100644 index 0000000000..dd5e9a4feb --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error.rs @@ -0,0 +1,49 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Orchestration and serialization glue logic for `CreateOrphanedError`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreateOrphanedError; +impl CreateOrphanedError { + /// Creates a new `CreateOrphanedError` + pub fn new() -> Self { + Self + } + + pub(crate) async fn send( + client: &crate::client::Client, + input: crate::operation::create_orphaned_error::CreateOrphanedErrorInput, + ) -> ::std::result::Result< + crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, + crate::types::error::Error, + > { + + let inner_input = crate::conversions::create_orphaned_error::_create_orphaned_error_input::to_dafny(input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).CreateOrphanedError(&inner_input); + if matches!( + inner_result.as_ref(), + crate::r#_Wrappers_Compile::Result::Success { .. } + ) { + Ok( + crate::conversions::create_orphaned_error::_create_orphaned_error_output::from_dafny(inner_result.value().clone()), + ) + } else { + Err(crate::conversions::error::from_dafny( + inner_result.error().clone(), + )) + } + } +} + +pub use crate::operation::create_orphaned_error::_create_orphaned_error_output::CreateOrphanedErrorOutput; + +pub use crate::operation::create_orphaned_error::_create_orphaned_error_input::CreateOrphanedErrorInput; + +pub(crate) mod _create_orphaned_error_output; + +pub(crate) mod _create_orphaned_error_input; + +/// Builders +pub mod builders; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_input.rs new file mode 100644 index 0000000000..16d493e8ae --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_input.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedErrorInput { + +} +impl CreateOrphanedErrorInput { + +} +impl CreateOrphanedErrorInput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedErrorInput`](crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInput). + pub fn builder() -> crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInputBuilder { + crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedErrorInput`](crate::operation::operation::CreateOrphanedErrorInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedErrorInputBuilder { + +} +impl CreateOrphanedErrorInputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedErrorInput`](crate::operation::operation::CreateOrphanedErrorInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::create_orphaned_error::CreateOrphanedErrorInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::create_orphaned_error::CreateOrphanedErrorInput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_output.rs new file mode 100644 index 0000000000..5b96b9a6bc --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_output.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedErrorOutput { + +} +impl CreateOrphanedErrorOutput { + +} +impl CreateOrphanedErrorOutput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedErrorOutput`](crate::operation::create_orphaned_error::builders::CreateOrphanedErrorOutput). + pub fn builder() -> crate::operation::create_orphaned_error::builders::CreateOrphanedErrorOutputBuilder { + crate::operation::create_orphaned_error::builders::CreateOrphanedErrorOutputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedErrorOutput`](crate::operation::operation::CreateOrphanedErrorOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedErrorOutputBuilder { + +} +impl CreateOrphanedErrorOutputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedErrorOutput`](crate::operation::operation::CreateOrphanedErrorOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::create_orphaned_error::CreateOrphanedErrorOutput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/builders.rs new file mode 100644 index 0000000000..6fb150757d --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/builders.rs @@ -0,0 +1,65 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::create_orphaned_error::_create_orphaned_error_output::CreateOrphanedErrorOutputBuilder; + +pub use crate::operation::create_orphaned_error::_create_orphaned_error_input::CreateOrphanedErrorInputBuilder; + +impl CreateOrphanedErrorInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with( + self, + client: &crate::client::Client, + ) -> ::std::result::Result< + crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, + crate::types::error::Error, + > { + let mut fluent_builder = client.create_orphaned_error(); + fluent_builder.inner = self; + fluent_builder.send().await + } +} +/// Fluent builder constructing a request to `CreateOrphanedError`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct CreateOrphanedErrorFluentBuilder { + client: crate::client::Client, + pub(crate) inner: crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInputBuilder, +} +impl CreateOrphanedErrorFluentBuilder { + /// Creates a new `CreateOrphanedError`. + pub(crate) fn new(client: crate::client::Client) -> Self { + Self { + client, + inner: ::std::default::Default::default(), + } + } + /// Access the CreateOrphanedError as a reference. + pub fn as_input(&self) -> &crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + pub async fn send( + self, + ) -> ::std::result::Result< + crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, + crate::types::error::Error, + > { + let input = self + .inner + .build() + // Using Opaque since we don't have a validation-specific error yet. + // Operations' models don't declare their own validation error, + // and smithy-rs seems to not generate a ValidationError case unless there is. + // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. + .map_err(|mut e| { + let msg = format!("{:?}", e); + crate::types::error::Error::OpaqueWithText { + obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any), + objMessage: msg + }})?; + crate::operation::create_orphaned_error::CreateOrphanedError::send(&self.client, input).await + } + + +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource.rs new file mode 100644 index 0000000000..9d690b02dd --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource.rs @@ -0,0 +1,49 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Orchestration and serialization glue logic for `CreateOrphanedResource`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreateOrphanedResource; +impl CreateOrphanedResource { + /// Creates a new `CreateOrphanedResource` + pub fn new() -> Self { + Self + } + + pub(crate) async fn send( + client: &crate::client::Client, + input: crate::operation::create_orphaned_resource::CreateOrphanedResourceInput, + ) -> ::std::result::Result< + crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, + crate::types::error::Error, + > { + + let inner_input = crate::conversions::create_orphaned_resource::_create_orphaned_resource_input::to_dafny(input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).CreateOrphanedResource(&inner_input); + if matches!( + inner_result.as_ref(), + crate::r#_Wrappers_Compile::Result::Success { .. } + ) { + Ok( + crate::conversions::create_orphaned_resource::_create_orphaned_resource_output::from_dafny(inner_result.value().clone()), + ) + } else { + Err(crate::conversions::error::from_dafny( + inner_result.error().clone(), + )) + } + } +} + +pub use crate::operation::create_orphaned_resource::_create_orphaned_resource_output::CreateOrphanedResourceOutput; + +pub use crate::operation::create_orphaned_resource::_create_orphaned_resource_input::CreateOrphanedResourceInput; + +pub(crate) mod _create_orphaned_resource_output; + +pub(crate) mod _create_orphaned_resource_input; + +/// Builders +pub mod builders; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_input.rs new file mode 100644 index 0000000000..2d011ae0e7 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_input.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedResourceInput { + +} +impl CreateOrphanedResourceInput { + +} +impl CreateOrphanedResourceInput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedResourceInput`](crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInput). + pub fn builder() -> crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInputBuilder { + crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedResourceInput`](crate::operation::operation::CreateOrphanedResourceInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedResourceInputBuilder { + +} +impl CreateOrphanedResourceInputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedResourceInput`](crate::operation::operation::CreateOrphanedResourceInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::create_orphaned_resource::CreateOrphanedResourceInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::create_orphaned_resource::CreateOrphanedResourceInput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_output.rs new file mode 100644 index 0000000000..5fe1e63483 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_output.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedResourceOutput { + +} +impl CreateOrphanedResourceOutput { + +} +impl CreateOrphanedResourceOutput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedResourceOutput`](crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceOutput). + pub fn builder() -> crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceOutputBuilder { + crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceOutputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedResourceOutput`](crate::operation::operation::CreateOrphanedResourceOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedResourceOutputBuilder { + +} +impl CreateOrphanedResourceOutputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedResourceOutput`](crate::operation::operation::CreateOrphanedResourceOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/builders.rs new file mode 100644 index 0000000000..474af09c1b --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/builders.rs @@ -0,0 +1,65 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::create_orphaned_resource::_create_orphaned_resource_output::CreateOrphanedResourceOutputBuilder; + +pub use crate::operation::create_orphaned_resource::_create_orphaned_resource_input::CreateOrphanedResourceInputBuilder; + +impl CreateOrphanedResourceInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with( + self, + client: &crate::client::Client, + ) -> ::std::result::Result< + crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, + crate::types::error::Error, + > { + let mut fluent_builder = client.create_orphaned_resource(); + fluent_builder.inner = self; + fluent_builder.send().await + } +} +/// Fluent builder constructing a request to `CreateOrphanedResource`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct CreateOrphanedResourceFluentBuilder { + client: crate::client::Client, + pub(crate) inner: crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInputBuilder, +} +impl CreateOrphanedResourceFluentBuilder { + /// Creates a new `CreateOrphanedResource`. + pub(crate) fn new(client: crate::client::Client) -> Self { + Self { + client, + inner: ::std::default::Default::default(), + } + } + /// Access the CreateOrphanedResource as a reference. + pub fn as_input(&self) -> &crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + pub async fn send( + self, + ) -> ::std::result::Result< + crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, + crate::types::error::Error, + > { + let input = self + .inner + .build() + // Using Opaque since we don't have a validation-specific error yet. + // Operations' models don't declare their own validation error, + // and smithy-rs seems to not generate a ValidationError case unless there is. + // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. + .map_err(|mut e| { + let msg = format!("{:?}", e); + crate::types::error::Error::OpaqueWithText { + obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any), + objMessage: msg + }})?; + crate::operation::create_orphaned_resource::CreateOrphanedResource::send(&self.client, input).await + } + + +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure.rs new file mode 100644 index 0000000000..2bd643fb3a --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure.rs @@ -0,0 +1,49 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Orchestration and serialization glue logic for `CreateOrphanedStructure`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreateOrphanedStructure; +impl CreateOrphanedStructure { + /// Creates a new `CreateOrphanedStructure` + pub fn new() -> Self { + Self + } + + pub(crate) async fn send( + client: &crate::client::Client, + input: crate::operation::create_orphaned_structure::CreateOrphanedStructureInput, + ) -> ::std::result::Result< + crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, + crate::types::error::Error, + > { + + let inner_input = crate::conversions::create_orphaned_structure::_create_orphaned_structure_input::to_dafny(input); + let inner_result = + ::dafny_runtime::md!(client.dafny_client.clone()).CreateOrphanedStructure(&inner_input); + if matches!( + inner_result.as_ref(), + crate::r#_Wrappers_Compile::Result::Success { .. } + ) { + Ok( + crate::conversions::create_orphaned_structure::_create_orphaned_structure_output::from_dafny(inner_result.value().clone()), + ) + } else { + Err(crate::conversions::error::from_dafny( + inner_result.error().clone(), + )) + } + } +} + +pub use crate::operation::create_orphaned_structure::_create_orphaned_structure_output::CreateOrphanedStructureOutput; + +pub use crate::operation::create_orphaned_structure::_create_orphaned_structure_input::CreateOrphanedStructureInput; + +pub(crate) mod _create_orphaned_structure_output; + +pub(crate) mod _create_orphaned_structure_input; + +/// Builders +pub mod builders; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_input.rs new file mode 100644 index 0000000000..ec6aca355b --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_input.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedStructureInput { + +} +impl CreateOrphanedStructureInput { + +} +impl CreateOrphanedStructureInput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedStructureInput`](crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInput). + pub fn builder() -> crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInputBuilder { + crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedStructureInput`](crate::operation::operation::CreateOrphanedStructureInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedStructureInputBuilder { + +} +impl CreateOrphanedStructureInputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedStructureInput`](crate::operation::operation::CreateOrphanedStructureInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::create_orphaned_structure::CreateOrphanedStructureInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::create_orphaned_structure::CreateOrphanedStructureInput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_output.rs new file mode 100644 index 0000000000..ce2be17069 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_output.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedStructureOutput { + +} +impl CreateOrphanedStructureOutput { + +} +impl CreateOrphanedStructureOutput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedStructureOutput`](crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureOutput). + pub fn builder() -> crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureOutputBuilder { + crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureOutputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedStructureOutput`](crate::operation::operation::CreateOrphanedStructureOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedStructureOutputBuilder { + +} +impl CreateOrphanedStructureOutputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedStructureOutput`](crate::operation::operation::CreateOrphanedStructureOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/builders.rs new file mode 100644 index 0000000000..f2fe536658 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/builders.rs @@ -0,0 +1,65 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::create_orphaned_structure::_create_orphaned_structure_output::CreateOrphanedStructureOutputBuilder; + +pub use crate::operation::create_orphaned_structure::_create_orphaned_structure_input::CreateOrphanedStructureInputBuilder; + +impl CreateOrphanedStructureInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with( + self, + client: &crate::client::Client, + ) -> ::std::result::Result< + crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, + crate::types::error::Error, + > { + let mut fluent_builder = client.create_orphaned_structure(); + fluent_builder.inner = self; + fluent_builder.send().await + } +} +/// Fluent builder constructing a request to `CreateOrphanedStructure`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct CreateOrphanedStructureFluentBuilder { + client: crate::client::Client, + pub(crate) inner: crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInputBuilder, +} +impl CreateOrphanedStructureFluentBuilder { + /// Creates a new `CreateOrphanedStructure`. + pub(crate) fn new(client: crate::client::Client) -> Self { + Self { + client, + inner: ::std::default::Default::default(), + } + } + /// Access the CreateOrphanedStructure as a reference. + pub fn as_input(&self) -> &crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + pub async fn send( + self, + ) -> ::std::result::Result< + crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, + crate::types::error::Error, + > { + let input = self + .inner + .build() + // Using Opaque since we don't have a validation-specific error yet. + // Operations' models don't declare their own validation error, + // and smithy-rs seems to not generate a ValidationError case unless there is. + // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. + .map_err(|mut e| { + let msg = format!("{:?}", e); + crate::types::error::Error::OpaqueWithText { + obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any), + objMessage: msg + }})?; + crate::operation::create_orphaned_structure::CreateOrphanedStructure::send(&self.client, input).await + } + + +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation.rs new file mode 100644 index 0000000000..b2a9895398 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation.rs @@ -0,0 +1,35 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Orchestration and serialization glue logic for `OrphanedResourceOperation`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct OrphanedResourceOperation; +impl OrphanedResourceOperation { + /// Creates a new `OrphanedResourceOperation` + pub fn new() -> Self { + Self + } + + pub(crate) async fn send( + orphaned_resource: &crate::types::orphaned_resource::OrphanedResourceRef, + input: crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, + ) -> ::std::result::Result< + crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, + crate::types::error::Error, + > { + + orphaned_resource.inner.borrow_mut().orphaned_resource_operation(input) + } +} + +pub use crate::operation::orphaned_resource_operation::_orphaned_resource_operation_output::OrphanedResourceOperationOutput; + +pub use crate::operation::orphaned_resource_operation::_orphaned_resource_operation_input::OrphanedResourceOperationInput; + +pub(crate) mod _orphaned_resource_operation_output; + +pub(crate) mod _orphaned_resource_operation_input; + +/// Builders +pub mod builders; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_input.rs new file mode 100644 index 0000000000..8c727c316a --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct OrphanedResourceOperationInput { + #[allow(missing_docs)] +pub some_string: ::std::option::Option<::std::string::String>, +} +impl OrphanedResourceOperationInput { + #[allow(missing_docs)] +pub fn some_string(&self) -> &::std::option::Option<::std::string::String> { + &self.some_string +} +} +impl OrphanedResourceOperationInput { + /// Creates a new builder-style object to manufacture [`OrphanedResourceOperationInput`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInput). + pub fn builder() -> crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInputBuilder { + crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInputBuilder::default() + } +} + +/// A builder for [`OrphanedResourceOperationInput`](crate::operation::operation::OrphanedResourceOperationInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct OrphanedResourceOperationInputBuilder { + pub(crate) some_string: ::std::option::Option<::std::string::String>, +} +impl OrphanedResourceOperationInputBuilder { + #[allow(missing_docs)] +pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.some_string = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.some_string = input; + self +} +#[allow(missing_docs)] +pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { + &self.some_string +} + /// Consumes the builder and constructs a [`OrphanedResourceOperationInput`](crate::operation::operation::OrphanedResourceOperationInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput { + some_string: self.some_string, + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_output.rs new file mode 100644 index 0000000000..82a3e7b38b --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct OrphanedResourceOperationOutput { + #[allow(missing_docs)] +pub some_string: ::std::option::Option<::std::string::String>, +} +impl OrphanedResourceOperationOutput { + #[allow(missing_docs)] +pub fn some_string(&self) -> &::std::option::Option<::std::string::String> { + &self.some_string +} +} +impl OrphanedResourceOperationOutput { + /// Creates a new builder-style object to manufacture [`OrphanedResourceOperationOutput`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationOutput). + pub fn builder() -> crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationOutputBuilder { + crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationOutputBuilder::default() + } +} + +/// A builder for [`OrphanedResourceOperationOutput`](crate::operation::operation::OrphanedResourceOperationOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct OrphanedResourceOperationOutputBuilder { + pub(crate) some_string: ::std::option::Option<::std::string::String>, +} +impl OrphanedResourceOperationOutputBuilder { + #[allow(missing_docs)] +pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.some_string = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.some_string = input; + self +} +#[allow(missing_docs)] +pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { + &self.some_string +} + /// Consumes the builder and constructs a [`OrphanedResourceOperationOutput`](crate::operation::operation::OrphanedResourceOperationOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput { + some_string: self.some_string, + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/builders.rs new file mode 100644 index 0000000000..4b5020828b --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/builders.rs @@ -0,0 +1,78 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::operation::orphaned_resource_operation::_orphaned_resource_operation_output::OrphanedResourceOperationOutputBuilder; + +pub use crate::operation::orphaned_resource_operation::_orphaned_resource_operation_input::OrphanedResourceOperationInputBuilder; + +impl OrphanedResourceOperationInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with( + self, + orphaned_resource: &crate::types::orphaned_resource::OrphanedResourceRef, + ) -> ::std::result::Result< + crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, + crate::types::error::Error, + > { + let mut fluent_builder = orphaned_resource.orphaned_resource_operation(); + fluent_builder.inner = self; + fluent_builder.send().await + } +} +/// Fluent builder constructing a request to `OrphanedResourceOperation`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct OrphanedResourceOperationFluentBuilder { + orphaned_resource: crate::types::orphaned_resource::OrphanedResourceRef, + pub(crate) inner: crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInputBuilder, +} +impl OrphanedResourceOperationFluentBuilder { + /// Creates a new `OrphanedResourceOperation`. + pub(crate) fn new(orphaned_resource: crate::types::orphaned_resource::OrphanedResourceRef) -> Self { + Self { + orphaned_resource, + inner: ::std::default::Default::default(), + } + } + /// Access the OrphanedResourceOperation as a reference. + pub fn as_input(&self) -> &crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + pub async fn send( + self, + ) -> ::std::result::Result< + crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, + crate::types::error::Error, + > { + let input = self + .inner + .build() + // Using Opaque since we don't have a validation-specific error yet. + // Operations' models don't declare their own validation error, + // and smithy-rs seems to not generate a ValidationError case unless there is. + // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. + .map_err(|mut e| { + let msg = format!("{:?}", e); + crate::types::error::Error::OpaqueWithText { + obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any), + objMessage: msg + }})?; + crate::operation::orphaned_resource_operation::OrphanedResourceOperation::send(&self.orphaned_resource, input).await + } + + #[allow(missing_docs)] +pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.some_string(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_some_string(input); + self +} +#[allow(missing_docs)] +pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_some_string() +} +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/simple_orphaned_impl.rs b/TestModels/OrphanedShapes/runtimes/rust/src/simple_orphaned_impl.rs new file mode 100644 index 0000000000..060483bc05 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/simple_orphaned_impl.rs @@ -0,0 +1,92 @@ +use std::rc::Rc; +use std::cell::UnsafeCell; +use dafny_runtime::rcmut; +use crate::r#_Wrappers_Compile::Result; + +pub mod internal_SimpleOrphanedImpl_Compile { + + use crate::conversions::*; + use crate::types::*; + use crate::implementation_from_dafny::_OrphanedResource_Compile::*; + use crate::implementation_from_dafny::_SimpleOrphanedImpl_Compile::_default; + use crate::simple::orphaned::internaldafny::types::*; + + + impl _default { + pub fn InitializeOrphanedStructure( + uninitialized_structure: &Rc, + ) -> Rc { + // Rc::clone(uninitialized_structure) + let native_structure = orphaned_structure::from_dafny(uninitialized_structure.clone()); + // I don't think generated Rust objects have a "toBuilder" method. + // Ideally, this extern would convert the Dafny structure to native, + // then set this property on the converted native structure. + // But that is sort of outside the scope of this TestModel. + // The fact that the from/to_dafny conversions above and below exist are the important things. + let native_structure_new = crate::types::OrphanedStructure::builder().set_string_value(Some( + "the extern MUST use Smithy-generated conversions to set this value in the native structure".to_string() + )).build().unwrap(); + return orphaned_structure::to_dafny(&native_structure_new); + } + + pub fn CallNativeOrphanedResource( + dafny_resource: &Object, + ) -> Rc, Rc>> + { + // let cloned_dafny_resource: Object = Rc::new(*dafny_resource.clone()); + // let cloned_dafny_resource: Object = Rc::clone(dafny_resource) as Object; + // let native_resource = orphaned_resource::from_dafny(cloned_dafny_resource).inner.borrow(); + // let cloned_dafny_resource: Object = Rc::new(*Rc::clone(dafny_resource)); + // let native_resource_ref = orphaned_resource::from_dafny(Object(Some(dafny_runtime::rcmut::RcMut::new(Box::new(*dafny_resource) as Box))); + // let native_resource_ref = orphaned_resource::from_dafny(Object::new(Box::new(*dafny_resource) as Box)); + // let native_resource_ref = orphaned_resource::from_dafny(dafny_runtime::Object(*(dafny_resource as &dyn IOrphanedResource))); + + let wrap = crate::conversions::orphaned_resource::IOrphanedResourceDafnyWrapper { + obj: dafny_resource.clone(), + }; + let native_resource_ref = crate::types::orphaned_resource::OrphanedResourceRef { + inner: ::std::rc::Rc::new(::std::cell::RefCell::new(wrap)) + }; + + // let rc_trait_object: Rc> = Rc::new(std::cell::UnsafeCell::new((*dafny_resource))); + // let option_trait_object: Option>> = Some(rc_trait_object); + // let native_resource_ref = orphaned_resource::from_dafny(Object(option_trait_object)); + + + let native_resource = native_resource_ref.inner.borrow(); + let native_output = native_resource.orphaned_resource_operation( + crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput{ + some_string : std::option::Option::Some ( + "the extern MUST provide this string to the native resource's operation".to_string() + ) + } + ); + + let dafny_output = orphaned_resource_operation::_orphaned_resource_operation_output::to_dafny(native_output.unwrap()); + + ::std::rc::Rc::new(Result::< + Rc, + Rc + >::Success { + value: dafny_output, + }) + } + + pub fn CallNativeOrphanedError( + dafny_error: &Rc, + ) -> Rc { + // Rc::clone(uninitialized_structure) + let native_error = crate::conversions::error::from_dafny(dafny_error.clone()); + // I don't think generated Rust objects have a "toBuilder" method. + // Ideally, this extern would convert the Dafny structure to native, + // then set this property on the converted native structure. + // But that is sort of outside the scope of this TestModel. + // The fact that the from/to_dafny conversions above and below exist are the important things. + let native_error_new = crate::types::error::Error::OrphanedError { + message : "the extern MUST use Smithy-generated conversions to set this value in the native error".to_string() + }; + return crate::conversions::error::to_dafny(native_error_new); + } + } + +} \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs new file mode 100644 index 0000000000..6bf8297d8a --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs @@ -0,0 +1,266 @@ +pub fn ostring_to_dafny( + input: &Option, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) + }, + None => crate::_Wrappers_Compile::Option::None {}, +}; + ::std::rc::Rc::new(dafny_value) +} + +pub fn ostring_from_dafny( + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some( + dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input.Extract(), + ), + ) + } else { + None + } +} + +pub fn obool_to_dafny( + input: &Option, +) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) +} + +pub fn obool_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } +} + +pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) +} + +pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } +} + +pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) +} + +pub fn olong_from_dafny( + input: ::std::rc::Rc>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(input.Extract()) + } else { + None + } +} + +pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) +} + +pub fn oblob_to_dafny( + input: &Option<::aws_smithy_types::Blob>, +) -> ::std::rc::Rc>> { + let dafny_value = match input { + Some(b) => crate::_Wrappers_Compile::Option::Some { + value: blob_to_dafny(&b), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) +} + +pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { + ::aws_smithy_types::Blob::new( + ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), + ) +} + +pub fn oblob_from_dafny( + input: ::std::rc::Rc>>, +) -> Option<::aws_smithy_types::Blob> { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(blob_from_dafny(input.Extract())) + } else { + None + } +} + +pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { + ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( + &f64::to_be_bytes(input).to_vec(), + |x| *x, + ) +} + +pub fn odouble_to_dafny( + input: &Option, +) -> ::std::rc::Rc>> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: double_to_dafny(*f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) +} + +pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { + let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); + f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) +} + +pub fn odouble_from_dafny( + input: ::std::rc::Rc>>, +) -> Option { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(double_from_dafny(&input.Extract())) + } else { + None + } +} + +pub fn timestamp_to_dafny( + input: &::aws_smithy_types::DateTime, +) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { + ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &input.to_string(), + ) +} + +pub fn otimestamp_to_dafny( + input: &Option<::aws_smithy_types::DateTime>, +) -> ::std::rc::Rc< + crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, +> { + let dafny_value = match input { + Some(f) => crate::_Wrappers_Compile::Option::Some { + value: timestamp_to_dafny(f), + }, + None => crate::_Wrappers_Compile::Option::None {}, + }; + ::std::rc::Rc::new(dafny_value) +} + +pub fn timestamp_from_dafny( + input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, +) -> ::aws_smithy_types::DateTime { + let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( + &input, + ); + ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) + .unwrap() +} + +pub fn otimestamp_from_dafny( + input: ::std::rc::Rc< + crate::_Wrappers_Compile::Option< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + >, +) -> Option<::aws_smithy_types::DateTime> { + if matches!( + input.as_ref(), + crate::_Wrappers_Compile::Option::Some { .. } + ) { + Some(timestamp_from_dafny(input.Extract())) + } else { + None + } +} + +pub fn option_from_dafny( + input: ::std::rc::Rc>, + converter: fn(&T) -> TR, +) -> Option { + match &*input { + crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), + crate::_Wrappers_Compile::Option::None {} => None, + } +} + +pub fn option_to_dafny( + input: &Option, + converter: fn(&TR) -> T, +) -> ::std::rc::Rc> { + match input { + Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { + value: converter(&value), + }), + None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), + } +} + +pub fn result_from_dafny( + input: ::std::rc::Rc>, + converter_t: fn(&T) -> TR, + converter_e: fn(&E) -> ER, +) -> Result { + match &*input { + crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), + crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), + } +} + +pub fn result_to_dafny( + input: &Result, + converter_t: fn(&TR) -> T, + converter_e: fn(&ER) -> E, +) -> ::std::rc::Rc> { + match input { + Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { + value: converter_t(&value), + }), + Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { + error: converter_e(&error), + }), + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs new file mode 100644 index 0000000000..f5f0f35fbd --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs @@ -0,0 +1,80 @@ +// Annotation to ignore the case of this module +use crate::r#_Wrappers_Compile; +use crate::implementation_from_dafny::UTF8; + +impl crate::implementation_from_dafny::UTF8::_default { + pub fn Encode( + s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let v = s.to_array(); + let mut _accumulator: Vec = vec![]; + // Use of .encode_utf8 method. + let mut surrogate: Option = None; + for c in v.iter() { + let s = if let Some(s) = surrogate { + String::from_utf16(&[s, c.0]) + } else { + String::from_utf16(&[c.0]) + }; + surrogate = None; + match s { + Ok(value) => { + _accumulator.extend(value.as_bytes()); + continue; + } + Err(e) => { + if 0xD800 <= c.0 && c.0 <= 0xDFFF { + surrogate = Some(c.0); + continue; + } + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }); + } + } + } + if let Some(s) = surrogate { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &format!("Surrogate pair missing: 0x{:04x}", s)) + }); + } + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< + UTF8::ValidUTF8Bytes, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >::Success { + value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), + }) + } + pub fn Decode( + b: &::dafny_runtime::Sequence, + ) -> ::std::rc::Rc< + r#_Wrappers_Compile::Result< + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + >, + > { + let b = String::from_utf8(b.to_array().as_ref().clone()); + match b { + Ok(s) => { + ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { + value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) + }) + }, + Err(e) => { + return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, + ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { + error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( + &e.to_string()) + }) + } + } + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types.rs new file mode 100644 index 0000000000..7a16420e89 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types.rs @@ -0,0 +1,39 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +/// Types for the `SimpleOrphanedConfig` +pub mod simple_orphaned_config; + +pub mod builders; + +pub mod orphaned_resource; +pub use orphaned_resource::OrphanedResource; + +mod _create_orphaned_error_input; +pub use crate::types::_create_orphaned_error_input::CreateOrphanedErrorInput; +mod _create_orphaned_error_output; +pub use crate::types::_create_orphaned_error_output::CreateOrphanedErrorOutput; +mod _create_orphaned_resource_input; +pub use crate::types::_create_orphaned_resource_input::CreateOrphanedResourceInput; +mod _create_orphaned_resource_output; +pub use crate::types::_create_orphaned_resource_output::CreateOrphanedResourceOutput; +mod _create_orphaned_structure_input; +pub use crate::types::_create_orphaned_structure_input::CreateOrphanedStructureInput; +mod _create_orphaned_structure_output; +pub use crate::types::_create_orphaned_structure_output::CreateOrphanedStructureOutput; +mod _orphaned_config_shape; +pub use crate::types::_orphaned_config_shape::OrphanedConfigShape; +mod _orphaned_resource_operation_input; +pub use crate::types::_orphaned_resource_operation_input::OrphanedResourceOperationInput; +mod _orphaned_resource_operation_output; +pub use crate::types::_orphaned_resource_operation_output::OrphanedResourceOperationOutput; +mod _orphaned_structure; +pub use crate::types::_orphaned_structure::OrphanedStructure; + +pub mod error; + +mod _orphaned_v1_enum; +pub use crate::types::_orphaned_v1_enum::OrphanedV1Enum; + +mod _orphaned_union; +pub use crate::types::_orphaned_union::OrphanedUnion; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_input.rs new file mode 100644 index 0000000000..4d30939f4e --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_input.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedErrorInput { + +} +impl CreateOrphanedErrorInput { + +} +impl CreateOrphanedErrorInput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedErrorInput`](crate::types::CreateOrphanedErrorInput). + pub fn builder() -> crate::types::builders::CreateOrphanedErrorInputBuilder { + crate::types::builders::CreateOrphanedErrorInputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedErrorInput`](crate::types::CreateOrphanedErrorInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedErrorInputBuilder { + +} +impl CreateOrphanedErrorInputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedErrorInput`](crate::types::CreateOrphanedErrorInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::CreateOrphanedErrorInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::CreateOrphanedErrorInput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_output.rs new file mode 100644 index 0000000000..5cddfae241 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_output.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedErrorOutput { + +} +impl CreateOrphanedErrorOutput { + +} +impl CreateOrphanedErrorOutput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedErrorOutput`](crate::types::CreateOrphanedErrorOutput). + pub fn builder() -> crate::types::builders::CreateOrphanedErrorOutputBuilder { + crate::types::builders::CreateOrphanedErrorOutputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedErrorOutput`](crate::types::CreateOrphanedErrorOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedErrorOutputBuilder { + +} +impl CreateOrphanedErrorOutputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedErrorOutput`](crate::types::CreateOrphanedErrorOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::CreateOrphanedErrorOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::CreateOrphanedErrorOutput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_input.rs new file mode 100644 index 0000000000..39e36d6d33 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_input.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedResourceInput { + +} +impl CreateOrphanedResourceInput { + +} +impl CreateOrphanedResourceInput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedResourceInput`](crate::types::CreateOrphanedResourceInput). + pub fn builder() -> crate::types::builders::CreateOrphanedResourceInputBuilder { + crate::types::builders::CreateOrphanedResourceInputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedResourceInput`](crate::types::CreateOrphanedResourceInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedResourceInputBuilder { + +} +impl CreateOrphanedResourceInputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedResourceInput`](crate::types::CreateOrphanedResourceInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::CreateOrphanedResourceInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::CreateOrphanedResourceInput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_output.rs new file mode 100644 index 0000000000..c031642cca --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_output.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedResourceOutput { + +} +impl CreateOrphanedResourceOutput { + +} +impl CreateOrphanedResourceOutput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedResourceOutput`](crate::types::CreateOrphanedResourceOutput). + pub fn builder() -> crate::types::builders::CreateOrphanedResourceOutputBuilder { + crate::types::builders::CreateOrphanedResourceOutputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedResourceOutput`](crate::types::CreateOrphanedResourceOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedResourceOutputBuilder { + +} +impl CreateOrphanedResourceOutputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedResourceOutput`](crate::types::CreateOrphanedResourceOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::CreateOrphanedResourceOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::CreateOrphanedResourceOutput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_input.rs new file mode 100644 index 0000000000..9d5442751c --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_input.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedStructureInput { + +} +impl CreateOrphanedStructureInput { + +} +impl CreateOrphanedStructureInput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedStructureInput`](crate::types::CreateOrphanedStructureInput). + pub fn builder() -> crate::types::builders::CreateOrphanedStructureInputBuilder { + crate::types::builders::CreateOrphanedStructureInputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedStructureInput`](crate::types::CreateOrphanedStructureInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedStructureInputBuilder { + +} +impl CreateOrphanedStructureInputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedStructureInput`](crate::types::CreateOrphanedStructureInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::CreateOrphanedStructureInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::CreateOrphanedStructureInput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_output.rs new file mode 100644 index 0000000000..4129f80fa5 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_output.rs @@ -0,0 +1,41 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct CreateOrphanedStructureOutput { + +} +impl CreateOrphanedStructureOutput { + +} +impl CreateOrphanedStructureOutput { + /// Creates a new builder-style object to manufacture [`CreateOrphanedStructureOutput`](crate::types::CreateOrphanedStructureOutput). + pub fn builder() -> crate::types::builders::CreateOrphanedStructureOutputBuilder { + crate::types::builders::CreateOrphanedStructureOutputBuilder::default() + } +} + +/// A builder for [`CreateOrphanedStructureOutput`](crate::types::CreateOrphanedStructureOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct CreateOrphanedStructureOutputBuilder { + +} +impl CreateOrphanedStructureOutputBuilder { + + /// Consumes the builder and constructs a [`CreateOrphanedStructureOutput`](crate::types::CreateOrphanedStructureOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::CreateOrphanedStructureOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::CreateOrphanedStructureOutput { + + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_config_shape.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_config_shape.rs new file mode 100644 index 0000000000..e6c9636e35 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_config_shape.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct OrphanedConfigShape { + #[allow(missing_docs)] +pub string_member: ::std::option::Option<::std::string::String>, +} +impl OrphanedConfigShape { + #[allow(missing_docs)] +pub fn string_member(&self) -> &::std::option::Option<::std::string::String> { + &self.string_member +} +} +impl OrphanedConfigShape { + /// Creates a new builder-style object to manufacture [`OrphanedConfigShape`](crate::types::OrphanedConfigShape). + pub fn builder() -> crate::types::builders::OrphanedConfigShapeBuilder { + crate::types::builders::OrphanedConfigShapeBuilder::default() + } +} + +/// A builder for [`OrphanedConfigShape`](crate::types::OrphanedConfigShape). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct OrphanedConfigShapeBuilder { + pub(crate) string_member: ::std::option::Option<::std::string::String>, +} +impl OrphanedConfigShapeBuilder { + #[allow(missing_docs)] +pub fn string_member(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.string_member = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_string_member(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.string_member = input; + self +} +#[allow(missing_docs)] +pub fn get_string_member(&self) -> &::std::option::Option<::std::string::String> { + &self.string_member +} + /// Consumes the builder and constructs a [`OrphanedConfigShape`](crate::types::OrphanedConfigShape). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::OrphanedConfigShape, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::OrphanedConfigShape { + string_member: self.string_member, + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_input.rs new file mode 100644 index 0000000000..f1a2b9b734 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_input.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct OrphanedResourceOperationInput { + #[allow(missing_docs)] +pub some_string: ::std::option::Option<::std::string::String>, +} +impl OrphanedResourceOperationInput { + #[allow(missing_docs)] +pub fn some_string(&self) -> &::std::option::Option<::std::string::String> { + &self.some_string +} +} +impl OrphanedResourceOperationInput { + /// Creates a new builder-style object to manufacture [`OrphanedResourceOperationInput`](crate::types::OrphanedResourceOperationInput). + pub fn builder() -> crate::types::builders::OrphanedResourceOperationInputBuilder { + crate::types::builders::OrphanedResourceOperationInputBuilder::default() + } +} + +/// A builder for [`OrphanedResourceOperationInput`](crate::types::OrphanedResourceOperationInput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct OrphanedResourceOperationInputBuilder { + pub(crate) some_string: ::std::option::Option<::std::string::String>, +} +impl OrphanedResourceOperationInputBuilder { + #[allow(missing_docs)] +pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.some_string = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.some_string = input; + self +} +#[allow(missing_docs)] +pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { + &self.some_string +} + /// Consumes the builder and constructs a [`OrphanedResourceOperationInput`](crate::types::OrphanedResourceOperationInput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::OrphanedResourceOperationInput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::OrphanedResourceOperationInput { + some_string: self.some_string, + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_output.rs new file mode 100644 index 0000000000..0f7e0d2d83 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_output.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct OrphanedResourceOperationOutput { + #[allow(missing_docs)] +pub some_string: ::std::option::Option<::std::string::String>, +} +impl OrphanedResourceOperationOutput { + #[allow(missing_docs)] +pub fn some_string(&self) -> &::std::option::Option<::std::string::String> { + &self.some_string +} +} +impl OrphanedResourceOperationOutput { + /// Creates a new builder-style object to manufacture [`OrphanedResourceOperationOutput`](crate::types::OrphanedResourceOperationOutput). + pub fn builder() -> crate::types::builders::OrphanedResourceOperationOutputBuilder { + crate::types::builders::OrphanedResourceOperationOutputBuilder::default() + } +} + +/// A builder for [`OrphanedResourceOperationOutput`](crate::types::OrphanedResourceOperationOutput). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct OrphanedResourceOperationOutputBuilder { + pub(crate) some_string: ::std::option::Option<::std::string::String>, +} +impl OrphanedResourceOperationOutputBuilder { + #[allow(missing_docs)] +pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.some_string = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.some_string = input; + self +} +#[allow(missing_docs)] +pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { + &self.some_string +} + /// Consumes the builder and constructs a [`OrphanedResourceOperationOutput`](crate::types::OrphanedResourceOperationOutput). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::OrphanedResourceOperationOutput, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::OrphanedResourceOperationOutput { + some_string: self.some_string, + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_structure.rs new file mode 100644 index 0000000000..7e1a8db8d9 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_structure.rs @@ -0,0 +1,234 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct OrphanedStructure { + #[allow(missing_docs)] +pub blob_value: ::std::option::Option<::aws_smithy_types::Blob>, +#[allow(missing_docs)] +pub boolean_value: ::std::option::Option<::std::primitive::bool>, +#[allow(missing_docs)] +pub enum_value: ::std::option::Option, +#[allow(missing_docs)] +pub integer_value: ::std::option::Option<::std::primitive::i32>, +#[allow(missing_docs)] +pub list_value: ::std::option::Option<::std::vec::Vec<::std::string::String>>, +#[allow(missing_docs)] +pub long_value: ::std::option::Option<::std::primitive::i64>, +#[allow(missing_docs)] +pub map_value: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>, +#[allow(missing_docs)] +pub string_value: ::std::option::Option<::std::string::String>, +#[allow(missing_docs)] +pub union_value: ::std::option::Option, +} +impl OrphanedStructure { + #[allow(missing_docs)] +pub fn blob_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { + &self.blob_value +} +#[allow(missing_docs)] +pub fn boolean_value(&self) -> &::std::option::Option<::std::primitive::bool> { + &self.boolean_value +} +#[allow(missing_docs)] +pub fn enum_value(&self) -> &::std::option::Option { + &self.enum_value +} +#[allow(missing_docs)] +pub fn integer_value(&self) -> &::std::option::Option<::std::primitive::i32> { + &self.integer_value +} +#[allow(missing_docs)] +pub fn list_value(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { + &self.list_value +} +#[allow(missing_docs)] +pub fn long_value(&self) -> &::std::option::Option<::std::primitive::i64> { + &self.long_value +} +#[allow(missing_docs)] +pub fn map_value(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> { + &self.map_value +} +#[allow(missing_docs)] +pub fn string_value(&self) -> &::std::option::Option<::std::string::String> { + &self.string_value +} +#[allow(missing_docs)] +pub fn union_value(&self) -> &::std::option::Option { + &self.union_value +} +} +impl OrphanedStructure { + /// Creates a new builder-style object to manufacture [`OrphanedStructure`](crate::types::OrphanedStructure). + pub fn builder() -> crate::types::builders::OrphanedStructureBuilder { + crate::types::builders::OrphanedStructureBuilder::default() + } +} + +/// A builder for [`OrphanedStructure`](crate::types::OrphanedStructure). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct OrphanedStructureBuilder { + pub(crate) blob_value: ::std::option::Option<::aws_smithy_types::Blob>, +pub(crate) boolean_value: ::std::option::Option<::std::primitive::bool>, +pub(crate) enum_value: ::std::option::Option, +pub(crate) integer_value: ::std::option::Option<::std::primitive::i32>, +pub(crate) list_value: ::std::option::Option<::std::vec::Vec<::std::string::String>>, +pub(crate) long_value: ::std::option::Option<::std::primitive::i64>, +pub(crate) map_value: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>, +pub(crate) string_value: ::std::option::Option<::std::string::String>, +pub(crate) union_value: ::std::option::Option, +} +impl OrphanedStructureBuilder { + #[allow(missing_docs)] +pub fn blob_value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self { + self.blob_value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_blob_value(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self { + self.blob_value = input; + self +} +#[allow(missing_docs)] +pub fn get_blob_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { + &self.blob_value +} +#[allow(missing_docs)] +pub fn boolean_value(mut self, input: impl ::std::convert::Into<::std::primitive::bool>) -> Self { + self.boolean_value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_boolean_value(mut self, input: ::std::option::Option<::std::primitive::bool>) -> Self { + self.boolean_value = input; + self +} +#[allow(missing_docs)] +pub fn get_boolean_value(&self) -> &::std::option::Option<::std::primitive::bool> { + &self.boolean_value +} +#[allow(missing_docs)] +pub fn enum_value(mut self, input: impl ::std::convert::Into) -> Self { + self.enum_value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_enum_value(mut self, input: ::std::option::Option) -> Self { + self.enum_value = input; + self +} +#[allow(missing_docs)] +pub fn get_enum_value(&self) -> &::std::option::Option { + &self.enum_value +} +#[allow(missing_docs)] +pub fn integer_value(mut self, input: impl ::std::convert::Into<::std::primitive::i32>) -> Self { + self.integer_value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_integer_value(mut self, input: ::std::option::Option<::std::primitive::i32>) -> Self { + self.integer_value = input; + self +} +#[allow(missing_docs)] +pub fn get_integer_value(&self) -> &::std::option::Option<::std::primitive::i32> { + &self.integer_value +} +#[allow(missing_docs)] +pub fn list_value(mut self, input: impl ::std::convert::Into<::std::vec::Vec<::std::string::String>>) -> Self { + self.list_value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_list_value(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self { + self.list_value = input; + self +} +#[allow(missing_docs)] +pub fn get_list_value(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { + &self.list_value +} +#[allow(missing_docs)] +pub fn long_value(mut self, input: impl ::std::convert::Into<::std::primitive::i64>) -> Self { + self.long_value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_long_value(mut self, input: ::std::option::Option<::std::primitive::i64>) -> Self { + self.long_value = input; + self +} +#[allow(missing_docs)] +pub fn get_long_value(&self) -> &::std::option::Option<::std::primitive::i64> { + &self.long_value +} +#[allow(missing_docs)] +pub fn map_value(mut self, input: impl ::std::convert::Into<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self { + self.map_value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_map_value(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self { + self.map_value = input; + self +} +#[allow(missing_docs)] +pub fn get_map_value(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> { + &self.map_value +} +#[allow(missing_docs)] +pub fn string_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.string_value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_string_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.string_value = input; + self +} +#[allow(missing_docs)] +pub fn get_string_value(&self) -> &::std::option::Option<::std::string::String> { + &self.string_value +} +#[allow(missing_docs)] +pub fn union_value(mut self, input: impl ::std::convert::Into) -> Self { + self.union_value = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_union_value(mut self, input: ::std::option::Option) -> Self { + self.union_value = input; + self +} +#[allow(missing_docs)] +pub fn get_union_value(&self) -> &::std::option::Option { + &self.union_value +} + /// Consumes the builder and constructs a [`OrphanedStructure`](crate::types::OrphanedStructure). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::OrphanedStructure, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::OrphanedStructure { + blob_value: self.blob_value, +boolean_value: self.boolean_value, +enum_value: self.enum_value, +integer_value: self.integer_value, +list_value: self.list_value, +long_value: self.long_value, +map_value: self.map_value, +string_value: self.string_value, +union_value: self.union_value, + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_union.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_union.rs new file mode 100644 index 0000000000..a90f6e5fa1 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_union.rs @@ -0,0 +1,53 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub enum OrphanedUnion { + #[allow(missing_docs)] +IntegerValue(::std::primitive::i32), +#[allow(missing_docs)] +StringValue(::std::string::String), + /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version. + /// An unknown enum variant + /// + /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._ + /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized + /// by the client. This can happen when the server adds new functionality, but the client has not been updated. + /// To investigate this, consider turning on debug logging to print the raw HTTP response. + #[non_exhaustive] + Unknown, +} +impl OrphanedUnion { + /// Tries to convert the enum instance into [`IntegerValue`](crate::types::OrphanedUnion::IntegerValue), extracting the inner [`::std::primitive::i32`](::std::primitive::i32). +/// Returns `Err(&Self)` if it can't be converted. +pub fn as_integer_value(&self) -> ::std::result::Result<&::std::primitive::i32, &Self> { + if let crate::types::OrphanedUnion::IntegerValue(val) = &self { + ::std::result::Result::Ok(val) + } else { + ::std::result::Result::Err(self) + } +} +/// Tries to convert the enum instance into [`StringValue`](crate::types::OrphanedUnion::StringValue), extracting the inner [`::std::string::String`](::std::string::String). +/// Returns `Err(&Self)` if it can't be converted. +pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> { + if let crate::types::OrphanedUnion::StringValue(val) = &self { + ::std::result::Result::Ok(val) + } else { + ::std::result::Result::Err(self) + } +} + /// Returns true if this is a [`IntegerValue`](crate::types::OrphanedUnion::IntegerValue). +pub fn is_integer_value(&self) -> ::std::primitive::bool { + self.as_integer_value().is_ok() +} +/// Returns true if this is a [`StringValue`](crate::types::OrphanedUnion::StringValue). +pub fn is_string_value(&self) -> ::std::primitive::bool { + self.as_string_value().is_ok() +} + /// Returns true if the enum instance is the `Unknown` variant. + pub fn is_unknown(&self) -> ::std::primitive::bool { + matches!(self, Self::Unknown) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_v1_enum.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_v1_enum.rs new file mode 100644 index 0000000000..6de6777284 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_v1_enum.rs @@ -0,0 +1,20 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[derive(Debug, PartialEq, Copy, Clone)] +#[allow(missing_docs)] +pub enum OrphanedV1Enum { + First, +Second, +Third, +} + +impl ::std::fmt::Display for OrphanedV1Enum { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + OrphanedV1Enum::First => write!(f, "FIRST"), +OrphanedV1Enum::Second => write!(f, "SECOND"), +OrphanedV1Enum::Third => write!(f, "THIRD"), + } + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/builders.rs new file mode 100644 index 0000000000..82ebdf1b81 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/builders.rs @@ -0,0 +1,22 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub use crate::types::_create_orphaned_error_input::CreateOrphanedErrorInputBuilder; + +pub use crate::types::_create_orphaned_error_output::CreateOrphanedErrorOutputBuilder; + +pub use crate::types::_create_orphaned_resource_input::CreateOrphanedResourceInputBuilder; + +pub use crate::types::_create_orphaned_resource_output::CreateOrphanedResourceOutputBuilder; + +pub use crate::types::_create_orphaned_structure_input::CreateOrphanedStructureInputBuilder; + +pub use crate::types::_create_orphaned_structure_output::CreateOrphanedStructureOutputBuilder; + +pub use crate::types::_orphaned_config_shape::OrphanedConfigShapeBuilder; + +pub use crate::types::_orphaned_resource_operation_input::OrphanedResourceOperationInputBuilder; + +pub use crate::types::_orphaned_resource_operation_output::OrphanedResourceOperationOutputBuilder; + +pub use crate::types::_orphaned_structure::OrphanedStructureBuilder; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/error.rs new file mode 100644 index 0000000000..dd505af9bd --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/error.rs @@ -0,0 +1,72 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[derive(::std::clone::Clone, ::std::fmt::Debug, ::std::cmp::PartialEq)] +pub enum Error { + #[allow(missing_docs)] +OrphanedError { + message: ::std::string::String, +}, + CollectionOfErrors { + list: ::std::vec::Vec, + message: ::std::string::String, + }, + ValidationError(ValidationError), + Opaque { + obj: ::dafny_runtime::Object, + }, + OpaqueWithText { + obj: ::dafny_runtime::Object, + objMessage: ::std::string::String, + }, +} + +impl ::std::cmp::Eq for Error {} + +impl ::std::fmt::Display for Error { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + Self::ValidationError(err) => ::std::fmt::Display::fmt(err, f), + _ => ::std::fmt::Debug::fmt(self, f), + } + } +} + +impl ::std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Self::ValidationError(err) => Some(err), + _ => None, + } + } +} + +impl Error { + pub fn wrap_validation_err(err: E) -> Self + where + E: ::std::error::Error + 'static, + { + Self::ValidationError(ValidationError(::std::rc::Rc::new(err))) + } +} + +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct ValidationError(::std::rc::Rc); + +impl ::std::cmp::PartialEq for ValidationError { + fn eq(&self, other: &Self) -> bool { + ::std::rc::Rc::<(dyn std::error::Error + 'static)>::ptr_eq(&self.0, &other.0) + } +} + +impl ::std::fmt::Display for ValidationError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + ::std::fmt::Display::fmt(&self.0, f) + } +} + +impl ::std::error::Error for ValidationError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + ::std::option::Option::Some(self.0.as_ref()) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource.rs new file mode 100644 index 0000000000..02651ed266 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource.rs @@ -0,0 +1,40 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + +#[allow(missing_docs)] +pub trait OrphanedResource { + fn orphaned_resource_operation( + &self, + input: crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, + ) -> Result< + crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, + crate::types::error::Error, + >; +} + +#[derive(::std::clone::Clone)] +/// A reference to a OrphanedResource +pub struct OrphanedResourceRef { + pub inner: ::std::rc::Rc> +} + +impl From for OrphanedResourceRef { + fn from(value: T) -> Self { + Self { inner: std::rc::Rc::new(std::cell::RefCell::new(value)) } + } +} + +impl ::std::cmp::PartialEq for OrphanedResourceRef { + fn eq(&self, other: &OrphanedResourceRef) -> bool { + ::std::rc::Rc::ptr_eq(&self.inner, &other.inner) + } +} + +impl ::std::fmt::Debug for OrphanedResourceRef { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "") + } +} + +mod orphaned_resource_operation; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource/orphaned_resource_operation.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource/orphaned_resource_operation.rs new file mode 100644 index 0000000000..b98dc9e406 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource/orphaned_resource_operation.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +impl crate::types::orphaned_resource::OrphanedResourceRef { + /// Constructs a fluent builder for the [`OrphanedResourceOperation`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`some_string(impl Into>)`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder::some_string) / [`set_some_string(Option<::std::string::String>)`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder::set_some_string): (undocumented)
+ /// - On success, responds with [`OrphanedResourceOperationOutput`](crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput) with field(s): + /// - [`some_string(Option<::std::string::String>)`](crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput::some_string): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::orphaned_resource_operation::OrphanedResourceOperationError) + pub fn orphaned_resource_operation(&self) -> crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder { + crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder::new(self.clone()) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/simple_orphaned_config.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/simple_orphaned_config.rs new file mode 100644 index 0000000000..eb80eea859 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/types/simple_orphaned_config.rs @@ -0,0 +1,58 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +#[allow(missing_docs)] +pub struct SimpleOrphanedConfig { + #[allow(missing_docs)] +pub structure_member: ::std::option::Option, +} +impl SimpleOrphanedConfig { + #[allow(missing_docs)] +pub fn structure_member(&self) -> &::std::option::Option { + &self.structure_member +} +} +impl SimpleOrphanedConfig { + /// Creates a new builder-style object to manufacture [`SimpleOrphanedConfig`](crate::types::SimpleOrphanedConfig). + pub fn builder() -> crate::types::simple_orphaned_config::SimpleOrphanedConfigBuilder { + crate::types::simple_orphaned_config::SimpleOrphanedConfigBuilder::default() + } +} + +/// A builder for [`SimpleOrphanedConfig`](crate::types::SimpleOrphanedConfig). +#[non_exhaustive] +#[derive( + ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, +)] +pub struct SimpleOrphanedConfigBuilder { + pub(crate) structure_member: ::std::option::Option, +} +impl SimpleOrphanedConfigBuilder { + #[allow(missing_docs)] +pub fn structure_member(mut self, input: impl ::std::convert::Into) -> Self { + self.structure_member = ::std::option::Option::Some(input.into()); + self +} +#[allow(missing_docs)] +pub fn set_structure_member(mut self, input: ::std::option::Option) -> Self { + self.structure_member = input; + self +} +#[allow(missing_docs)] +pub fn get_structure_member(&self) -> &::std::option::Option { + &self.structure_member +} + /// Consumes the builder and constructs a [`SimpleOrphanedConfig`](crate::types::SimpleOrphanedConfig). + pub fn build( + self, + ) -> ::std::result::Result< + crate::types::simple_orphaned_config::SimpleOrphanedConfig, + ::aws_smithy_types::error::operation::BuildError, + > { + ::std::result::Result::Ok(crate::types::simple_orphaned_config::SimpleOrphanedConfig { + structure_member: self.structure_member, + }) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped.rs b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped.rs new file mode 100644 index 0000000000..26b4d6f29e --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped.rs @@ -0,0 +1,15 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +pub mod client; + +impl crate::r#simple::orphaned::internaldafny::wrapped::_default { + pub fn WrappedSimpleOrphaned(config: &::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, + >) -> ::std::rc::Rc, + ::std::rc::Rc + >>{ + crate::wrapped::client::Client::from_conf(config) + } +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs new file mode 100644 index 0000000000..245466d839 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs @@ -0,0 +1,140 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +use std::sync::LazyLock; + +pub struct Client { + wrapped: crate::client::Client +} + +/// A runtime for executing operations on the asynchronous client in a blocking manner. +/// Necessary because Dafny only generates synchronous code. +static dafny_tokio_runtime: LazyLock = LazyLock::new(|| { + tokio::runtime::Builder::new_multi_thread() + .enable_all() + .build() + .unwrap() +}); + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient); +} + +impl dafny_runtime::UpcastObject for Client { + ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); +} + +impl Client { + pub fn from_conf(config: &::std::rc::Rc< + crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, + >) -> +::std::rc::Rc, + ::std::rc::Rc +>> { + let result = crate::client::Client::from_conf( + crate::conversions::simple_orphaned_config::_simple_orphaned_config::from_dafny( + config.clone(), + ), + ); + match result { + Ok(client) => { + let wrap = crate::wrapped::client::Client { + wrapped: client + }; + std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) + } + ) + }, + Err(error) => { + let msg = format!("{:?}", error); + crate::conversions::error::to_opaque_error_result(msg) + } + } + } +} + +impl crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient for Client { + fn CreateOrphanedResource( + &self, + input: &::std::rc::Rc, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + ::std::rc::Rc, + std::rc::Rc, + >, + >{ + let inner_input = crate::conversions::create_orphaned_resource::_create_orphaned_resource_input::from_dafny(input.clone()); + let result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(crate::operation::create_orphaned_resource::CreateOrphanedResource::send(&self.wrapped, inner_input)) + }); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::error::to_dafny(error), + }, + ), + Ok(inner_result) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::create_orphaned_resource::_create_orphaned_resource_output::to_dafny(inner_result), + }, + ), + } + } + + fn CreateOrphanedError( + &self, + input: &::std::rc::Rc, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + ::std::rc::Rc, + std::rc::Rc, + >, + >{ + let inner_input = crate::conversions::create_orphaned_error::_create_orphaned_error_input::from_dafny(input.clone()); + let result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(crate::operation::create_orphaned_error::CreateOrphanedError::send(&self.wrapped, inner_input)) + }); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::error::to_dafny(error), + }, + ), + Ok(inner_result) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::create_orphaned_error::_create_orphaned_error_output::to_dafny(inner_result), + }, + ), + } + } + + fn CreateOrphanedStructure( + &self, + input: &::std::rc::Rc, + ) -> std::rc::Rc< + crate::r#_Wrappers_Compile::Result< + ::std::rc::Rc, + std::rc::Rc, + >, + >{ + let inner_input = crate::conversions::create_orphaned_structure::_create_orphaned_structure_input::from_dafny(input.clone()); + let result = tokio::task::block_in_place(|| { + dafny_tokio_runtime.block_on(crate::operation::create_orphaned_structure::CreateOrphanedStructure::send(&self.wrapped, inner_input)) + }); + match result { + Err(error) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Failure { + error: crate::conversions::error::to_dafny(error), + }, + ), + Ok(inner_result) => ::std::rc::Rc::new( + crate::_Wrappers_Compile::Result::Success { + value: crate::conversions::create_orphaned_structure::_create_orphaned_structure_output::to_dafny(inner_result), + }, + ), + } + } +} diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy index 972452ae77..0c8ccbfe92 100644 --- a/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy +++ b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy @@ -73,7 +73,7 @@ module {:extern} SimpleOrphanedImpl refines AbstractSimpleOrphanedOperations { // and wouldn't be useful in an "orphaned shapes" TestModel. // Putting all usage of the orphaned shape outside the model's knowledge // lets us test orphaned shape model/conversion generation. - method {:extern} CallNativeOrphanedResource( input: OrphanedResource.OrphanedResource ) + method {:extern} CallNativeOrphanedResource( input: Types.IOrphanedResource ) returns (output: Result) method CreateOrphanedError ( config: InternalConfig, input: CreateOrphanedErrorInput ) diff --git a/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy b/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy deleted file mode 100644 index fb1241511d..0000000000 --- a/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -include "../src/Index.dfy" -include "./Helpers.dfy" -include "../src/MutableResource.dfy" - -module SimpleResourcesTest { - import SimpleResources - import Types = SimpleResourcesTypes - import opened Wrappers - import opened Helpers - - method TestNoneGetData( - config: Types.SimpleResourcesConfig, - resource: Types.ISimpleResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allNone(); - var result :- expect resource.GetResourceData(input); - checkMostNone(config.name, result); - } - - method TestSomeGetData( - config: Types.SimpleResourcesConfig, - resource: Types.ISimpleResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allSome(); - var output :- expect resource.GetResourceData(input); - checkSome(config.name, output); - } - - method TestGetResources( - config: Types.SimpleResourcesConfig, - client: Types.ISimpleResourcesClient - ) returns ( - resource: Types.ISimpleResource - ) - requires client.ValidState() - modifies client.Modifies - ensures client.ValidState() - ensures resource.Modifies !! {client.History} - ensures fresh(resource.Modifies - client.Modifies - {client.History} ) - ensures resource.ValidState() && fresh(resource) - { - var input := Types.GetResourcesInput( - value := Some("Test") - ); - var output :- expect client.GetResources(input); - return output.output; - } - - method TestClient(config: Types.SimpleResourcesConfig) - { - var client :- expect SimpleResources.SimpleResources(config); - var resource := TestGetResources(config, client); - TestNoneGetData(config, resource); - TestSomeGetData(config, resource); - - var mutableResource := TestGetMutableResources(config, client); - TestMutableNoneGetData(config, mutableResource); - TestMutableSomeGetData(config, mutableResource); - } - - method {:test} TestDefaultConfig() - { - TestClient(SimpleResources.DefaultSimpleResourcesConfig()); - } - - method {:test} TestCustomConfig() - { - TestClient(Types.SimpleResourcesConfig(name := "Dafny")); - } - - // This is breaking encapsulation - // this is not something for public clients to do. - // this is to access the internal state and verify that specific things are true/false. - import MutableResource = MutableResource`ForTesting - - method TestMutableNoneGetData( - config: Types.SimpleResourcesConfig, - resource: Types.IMutableResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allMutableNone(); - - expect resource is MutableResource.MutableResource; - var test:MutableResource.MutableResource := resource; - - var before := test.MyInternalState; - - var result :- expect resource.GetMutableResourceData(input); - checkMutableMostNone(config.name, result); - - // This sort of things SHOULD NOT be able to be proved. - // Dafny does not have a way to say `assert something is impossible to prove;` - // assert before != test.MyInternalState; - - // This is assuming that everything verifies - // Given that, the Dafny in MutableResource - // was able to prove MutableResource, - // and the Types file was correct - // This is a basic check to make sure - // that this simplified separated class works. - expect before + 1 == test.MyInternalState; - } - - method TestMutableSomeGetData( - config: Types.SimpleResourcesConfig, - resource: Types.IMutableResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allMutableSome(); - var output :- expect resource.GetMutableResourceData(input); - checkMutableSome(config.name, output); - } - - method TestGetMutableResources( - config: Types.SimpleResourcesConfig, - client: Types.ISimpleResourcesClient - ) returns ( - resource: Types.IMutableResource - ) - requires client.ValidState() - modifies client.Modifies - ensures client.ValidState() - ensures resource.Modifies !! {client.History} - ensures fresh(resource.Modifies - client.Modifies - {client.History} ) - ensures resource.ValidState() && fresh(resource) - { - var input := Types.GetMutableResourcesInput( - value := Some("Test") - ); - var output :- expect client.GetMutableResources(input); - return output.output; - } - -} From 96c568f08ab75a5fd2963291a0f0c7a2a7babe6a Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Fri, 22 Nov 2024 13:13:07 -0800 Subject: [PATCH 12/32] m --- TestModels/OrphanedShapes/Makefile | 48 ++++++ .../Model/OrphanedShapes.smithy | 46 ++++++ .../OrphanedShapes/src/OrphanedResource.dfy | 69 ++++++++ .../src/SimpleOrphanedShapesImpl.dfy | 50 ++++++ .../test/OrphanedShapesTest.dfy | 151 ++++++++++++++++++ .../OrphanedShapes/test/WrappedTest.dfy | 28 ++++ ...irectedDafnyPythonLocalServiceCodegen.java | 31 ++++ 7 files changed, 423 insertions(+) create mode 100644 TestModels/OrphanedShapes/Makefile create mode 100644 TestModels/OrphanedShapes/Model/OrphanedShapes.smithy create mode 100644 TestModels/OrphanedShapes/src/OrphanedResource.dfy create mode 100644 TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy create mode 100644 TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy create mode 100644 TestModels/OrphanedShapes/test/WrappedTest.dfy diff --git a/TestModels/OrphanedShapes/Makefile b/TestModels/OrphanedShapes/Makefile new file mode 100644 index 0000000000..b39ff14345 --- /dev/null +++ b/TestModels/OrphanedShapes/Makefile @@ -0,0 +1,48 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +CORES=2 + +ENABLE_EXTERN_PROCESSING=1 +TRANSPILE_TESTS_IN_RUST=1 + +include ../SharedMakefile.mk + +NAMESPACE=simple.positional + +PROJECT_SERVICES := \ + SimplePositional + +MAIN_SERVICE_FOR_RUST := SimplePositional + +SERVICE_NAMESPACE_SimplePositional=simple.positional + +SERVICE_DEPS_SimplePositional := + +SMITHY_DEPS=dafny-dependencies/Model/traits.smithy + +# This project has no dependencies +# DEPENDENT-MODELS:= + +POLYMORPH_OPTIONS=--generate project-files,client-constructors + +# Python + +PYTHON_MODULE_NAME=simple_positional + +TRANSLATION_RECORD_PYTHON := \ + --translation-record ../dafny-dependencies/StandardLibrary/runtimes/python/src/smithy_dafny_standard_library/internaldafny/generated/dafny_src-py.dtr + +# Constants for languages that drop extern names (Python, Go) + +TYPES_FILE_PATH=Model/SimplePositionalTypes.dfy +TYPES_FILE_WITH_EXTERN_STRING="module {:extern \"simple.positional.internaldafny.types\" } SimplePositionalTypes" +TYPES_FILE_WITHOUT_EXTERN_STRING="module SimplePositionalTypes" + +INDEX_FILE_PATH=src/Index.dfy +INDEX_FILE_WITH_EXTERN_STRING="module {:extern \"simple.positional.internaldafny\" } SimplePositional refines AbstractSimplePositionalService {" +INDEX_FILE_WITHOUT_EXTERN_STRING="module SimplePositional refines AbstractSimplePositionalService {" + +WRAPPED_INDEX_FILE_PATH=src/WrappedSimplePositionalImpl.dfy +WRAPPED_INDEX_FILE_WITH_EXTERN_STRING="module {:options \"--function-syntax:4\"} {:extern \"simple.positional.internaldafny.wrapped\"} WrappedSimplePositionalService refines WrappedAbstractSimplePositionalService {" +WRAPPED_INDEX_FILE_WITHOUT_EXTERN_STRING="module {:options \"--function-syntax:4\"} WrappedSimplePositionalService refines WrappedAbstractSimplePositionalService {" diff --git a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy new file mode 100644 index 0000000000..032adea24d --- /dev/null +++ b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy @@ -0,0 +1,46 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +$version: "2" +namespace simple.orphanedShapes + +@aws.polymorph#localService( + sdkId: "SimpleLocalService", + config: SimpleLocalServiceConfig, +) +service SimpleLocalService { + version: "2021-11-01", + resources: [], + operations: [HelloWorld, SelfReflection], + errors: [ SimpleLocalServiceException ], +} + +structure SimpleLocalServiceConfig {} + +@error("client") +structure SimpleLocalServiceException { + @required + message: String, +} + +@aws.polymorph#reference(service: SimpleLocalService) +structure SimpleLocalServiceReference {} + +operation SelfReflection { + input := { + @required + client: SimpleLocalServiceReference + } + output := { + @required + greeting: String + } +} + +operation HelloWorld { + input := { + } + output := { + @required + greeting: String + } +} \ No newline at end of file diff --git a/TestModels/OrphanedShapes/src/OrphanedResource.dfy b/TestModels/OrphanedShapes/src/OrphanedResource.dfy new file mode 100644 index 0000000000..601071bd5c --- /dev/null +++ b/TestModels/OrphanedShapes/src/OrphanedResource.dfy @@ -0,0 +1,69 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +include "../Model/SimpleResourcesTypes.dfy" + +module SimpleResource { + import opened StandardLibrary + import opened Wrappers + import Types = SimpleResourcesTypes + + class SimpleResource extends Types.ISimpleResource + { + predicate ValidState() + ensures ValidState() ==> History in Modifies + { + && History in Modifies + } + + const name: string + const value: Option + + constructor ( + value: Option, + name: string + ) + requires |name| > 0 + ensures this.value == value + ensures this.name == name + ensures ValidState() && fresh(History) && fresh(Modifies) + { + this.value := value; + this.name := name; + + History := new Types.ISimpleResourceCallHistory(); + Modifies := {History}; + } + + predicate GetResourceDataEnsuresPublicly( + input: Types.GetResourceDataInput, + output: Result + ) {true} + + method GetResourceData'( + input: Types.GetResourceDataInput + ) returns ( + output: Result + ) + requires ValidState() + modifies Modifies - {History} + decreases Modifies - {History} + ensures && ValidState() + ensures GetResourceDataEnsuresPublicly(input, output) + ensures unchanged(History) + { + var rtnString: string := if input.stringValue.Some? then + this.name + " " + input.stringValue.value + else + this.name; + var rtn: Types.GetResourceDataOutput := Types.GetResourceDataOutput( + blobValue := input.blobValue, + booleanValue := input.booleanValue, + stringValue := Some(rtnString), + integerValue := input.integerValue, + longValue := input.longValue + ); + return Success(rtn); + } + } +} diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy new file mode 100644 index 0000000000..d02db0b1a2 --- /dev/null +++ b/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy @@ -0,0 +1,50 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. +include "../Model/SimplePositionalTypes.dfy" +include "./SimpleResource.dfy" +module SimplePositionalImpl refines AbstractSimplePositionalOperations { + import SimpleResource + + datatype Config = Config + type InternalConfig = Config + + predicate ValidInternalConfig?(config: InternalConfig) + {true} + function ModifiesInternalConfig(config: InternalConfig): set + {{}} + predicate GetResourceEnsuresPublicly(input: GetResourceInput , output: Result) + {true} + + + + method GetResource ( config: InternalConfig , input: GetResourceInput ) + returns (output: Result) + + { + var resource := new SimpleResource.SimpleResource( + input.name + ); + var result: GetResourceOutput := GetResourceOutput( + output := resource + ); + return Success(result); + } + + + predicate GetResourcePositionalEnsuresPublicly(input: string , output: Result) + {true} + + + + // @positional allows use to accept the input parameters directly without the input structure + method GetResourcePositional ( config: InternalConfig , input: string ) + returns (output: Result) + + { + var resource := new SimpleResource.SimpleResource(input); + + // @positional allows use to return the result without the output structure + return Success(resource); + } +} diff --git a/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy b/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy new file mode 100644 index 0000000000..fb1241511d --- /dev/null +++ b/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy @@ -0,0 +1,151 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +include "../src/Index.dfy" +include "./Helpers.dfy" +include "../src/MutableResource.dfy" + +module SimpleResourcesTest { + import SimpleResources + import Types = SimpleResourcesTypes + import opened Wrappers + import opened Helpers + + method TestNoneGetData( + config: Types.SimpleResourcesConfig, + resource: Types.ISimpleResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allNone(); + var result :- expect resource.GetResourceData(input); + checkMostNone(config.name, result); + } + + method TestSomeGetData( + config: Types.SimpleResourcesConfig, + resource: Types.ISimpleResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allSome(); + var output :- expect resource.GetResourceData(input); + checkSome(config.name, output); + } + + method TestGetResources( + config: Types.SimpleResourcesConfig, + client: Types.ISimpleResourcesClient + ) returns ( + resource: Types.ISimpleResource + ) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + ensures resource.Modifies !! {client.History} + ensures fresh(resource.Modifies - client.Modifies - {client.History} ) + ensures resource.ValidState() && fresh(resource) + { + var input := Types.GetResourcesInput( + value := Some("Test") + ); + var output :- expect client.GetResources(input); + return output.output; + } + + method TestClient(config: Types.SimpleResourcesConfig) + { + var client :- expect SimpleResources.SimpleResources(config); + var resource := TestGetResources(config, client); + TestNoneGetData(config, resource); + TestSomeGetData(config, resource); + + var mutableResource := TestGetMutableResources(config, client); + TestMutableNoneGetData(config, mutableResource); + TestMutableSomeGetData(config, mutableResource); + } + + method {:test} TestDefaultConfig() + { + TestClient(SimpleResources.DefaultSimpleResourcesConfig()); + } + + method {:test} TestCustomConfig() + { + TestClient(Types.SimpleResourcesConfig(name := "Dafny")); + } + + // This is breaking encapsulation + // this is not something for public clients to do. + // this is to access the internal state and verify that specific things are true/false. + import MutableResource = MutableResource`ForTesting + + method TestMutableNoneGetData( + config: Types.SimpleResourcesConfig, + resource: Types.IMutableResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allMutableNone(); + + expect resource is MutableResource.MutableResource; + var test:MutableResource.MutableResource := resource; + + var before := test.MyInternalState; + + var result :- expect resource.GetMutableResourceData(input); + checkMutableMostNone(config.name, result); + + // This sort of things SHOULD NOT be able to be proved. + // Dafny does not have a way to say `assert something is impossible to prove;` + // assert before != test.MyInternalState; + + // This is assuming that everything verifies + // Given that, the Dafny in MutableResource + // was able to prove MutableResource, + // and the Types file was correct + // This is a basic check to make sure + // that this simplified separated class works. + expect before + 1 == test.MyInternalState; + } + + method TestMutableSomeGetData( + config: Types.SimpleResourcesConfig, + resource: Types.IMutableResource + ) + requires resource.ValidState() + modifies resource.Modifies + ensures resource.ValidState() + { + var input := allMutableSome(); + var output :- expect resource.GetMutableResourceData(input); + checkMutableSome(config.name, output); + } + + method TestGetMutableResources( + config: Types.SimpleResourcesConfig, + client: Types.ISimpleResourcesClient + ) returns ( + resource: Types.IMutableResource + ) + requires client.ValidState() + modifies client.Modifies + ensures client.ValidState() + ensures resource.Modifies !! {client.History} + ensures fresh(resource.Modifies - client.Modifies - {client.History} ) + ensures resource.ValidState() && fresh(resource) + { + var input := Types.GetMutableResourcesInput( + value := Some("Test") + ); + var output :- expect client.GetMutableResources(input); + return output.output; + } + +} diff --git a/TestModels/OrphanedShapes/test/WrappedTest.dfy b/TestModels/OrphanedShapes/test/WrappedTest.dfy new file mode 100644 index 0000000000..dbb599154b --- /dev/null +++ b/TestModels/OrphanedShapes/test/WrappedTest.dfy @@ -0,0 +1,28 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +include "../src/WrappedIndex.dfy" +include "./SimpleResourcesTest.dfy" + +module WrappedTest { + import opened SimpleResourcesTest + import WrappedSimpleResources + import opened Types = SimpleResourcesTypes + import opened Wrappers + + method TestWrappedClient(config: Types.SimpleResourcesConfig) + { + var client :- expect WrappedSimpleResources.WrappedSimpleResources(config); + var resource := TestGetResources(config, client); + TestNoneGetData(config, resource); + TestSomeGetData(config, resource); + } + + method {:test} WrappedTestDefaultConfig() { + TestWrappedClient(WrappedSimpleResources.WrappedDefaultSimpleResourcesConfig()); + } + + method {:test} WrappedTestCustomConfig() { + TestWrappedClient(Types.SimpleResourcesConfig(name := "Dafny")); + } +} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 4e3dadf6d7..29444cc09b 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -12,6 +12,8 @@ import software.amazon.polymorph.smithypython.common.nameresolver.SmithyNameResolver; import software.amazon.polymorph.smithypython.localservice.DafnyLocalServiceCodegenConstants; import software.amazon.polymorph.smithypython.localservice.customize.ReferencesFileWriter; +import software.amazon.polymorph.smithypython.localservice.shapevisitor.conversionwriter.DafnyToLocalServiceConversionFunctionWriter; +import software.amazon.polymorph.smithypython.localservice.shapevisitor.conversionwriter.LocalServiceToDafnyConversionFunctionWriter; import software.amazon.smithy.build.FileManifest; import software.amazon.smithy.codegen.core.*; import software.amazon.smithy.codegen.core.directed.*; @@ -522,6 +524,35 @@ protected void generateOrphanedShapesForService( shapeToGenerate ); } + + final WriterDelegator delegator = directive.context().writerDelegator(); + final String moduleName = + SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( + directive.context().settings().getService().getNamespace() + ); + + delegator.useFileWriter( + moduleName + "/dafny_to_smithy.py", + "", + conversionWriter -> { + DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + + delegator.useFileWriter( + moduleName + "/smithy_to_dafny.py", + "", + conversionWriter -> { + LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + } } From 5ff1750f85734b4978aefdb684fa9fe1886a188b Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Tue, 10 Dec 2024 15:56:52 -0800 Subject: [PATCH 13/32] go --- SmithyDafnyMakefile.mk | 2 +- .../WrappedSimpleExternService/shim.go | 1 - TestModels/OrphanedShapes/Makefile | 9 +- .../Model/OrphanedShapes.smithy | 6 +- .../rust/src/standard_library_conversions.rs | 3 + .../rust/src/standard_library_externs.rs | 3 + .../runtimes/rust/src/wrapped/client.rs | 36 ++--- TestModels/OrphanedShapes/src/Index.dfy | 2 +- .../OrphanedShapes/src/SimpleOrphanedImpl.dfy | 141 ++++++---------- .../src/SimpleOrphanedShapesImpl.dfy | 50 ------ .../src/WrappedSimpleOrphanedImpl.dfy | 2 +- .../test/OrphanedShapesTest.dfy | 151 ------------------ .../OrphanedShapes/test/WrappedTest.dfy | 47 +++--- .../Model/RecursiveShape.smithy | 15 +- .../extern/wrapped_simple_blob.py | 6 +- .../test/internaldafny/test_dafny_wrapper.py | 9 +- .../DafnyLocalServiceDirectedCodegen.java | 6 +- ...fnyLocalServiceTypeConversionProtocol.java | 23 ++- 18 files changed, 156 insertions(+), 356 deletions(-) delete mode 100644 TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy delete mode 100644 TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy diff --git a/SmithyDafnyMakefile.mk b/SmithyDafnyMakefile.mk index 8027e465fa..692f994af1 100644 --- a/SmithyDafnyMakefile.mk +++ b/SmithyDafnyMakefile.mk @@ -336,7 +336,7 @@ _polymorph_dependencies: polymorph_code_gen: POLYMORPH_LANGUAGE_TARGET=code_gen polymorph_code_gen: _polymorph_dependencies polymorph_code_gen: - set -e; for service in $(PROJECT_SERVICES) ; do \ + set -e; for service in $(PROJECT_SERVICES) ; do \go export service_deps_var=SERVICE_DEPS_$${service} ; \ export namespace_var=SERVICE_NAMESPACE_$${service} ; \ export SERVICE=$${service} ; \ diff --git a/TestModels/Extern/runtimes/go/TestsFromDafny-go/WrappedSimpleExternService/shim.go b/TestModels/Extern/runtimes/go/TestsFromDafny-go/WrappedSimpleExternService/shim.go index 8dc66307da..32377e6dae 100644 --- a/TestModels/Extern/runtimes/go/TestsFromDafny-go/WrappedSimpleExternService/shim.go +++ b/TestModels/Extern/runtimes/go/TestsFromDafny-go/WrappedSimpleExternService/shim.go @@ -5,7 +5,6 @@ package WrappedSimpleExternService import ( "context" - "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" "github.com/smithy-lang/smithy-dafny/TestModels/Extern/SimpleDafnyExternTypes" "github.com/smithy-lang/smithy-dafny/TestModels/Extern/simpledafnyexternsmithygenerated" diff --git a/TestModels/OrphanedShapes/Makefile b/TestModels/OrphanedShapes/Makefile index 6934bbce7e..1868f402e0 100644 --- a/TestModels/OrphanedShapes/Makefile +++ b/TestModels/OrphanedShapes/Makefile @@ -24,7 +24,14 @@ SMITHY_DEPS=dafny-dependencies/Model/traits.smithy # This project has no dependencies # DEPENDENT-MODELS:= -POLYMORPH_OPTIONS=--generate project-files,client-constructors +POLYMORPH_OPTIONS=--generate project-files,client-constructors\ + +# Go + +GO_MODULE_NAME="github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" + +TRANSLATION_RECORD_GO := \ + dafny-dependencies/StandardLibrary/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr # Python diff --git a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy index 4fa851bc3d..e51946e51e 100644 --- a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy +++ b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy @@ -12,9 +12,9 @@ service SimpleOrphaned { version: "2021-11-01", resources: [], operations: [ - CreateOrphanedStructure, - CreateOrphanedResource, - CreateOrphanedError, + // CreateOrphanedStructure, + // CreateOrphanedResource, + // CreateOrphanedError, ], } diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs index 6bf8297d8a..5c00049018 100644 --- a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs +++ b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs @@ -1,3 +1,6 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + pub fn ostring_to_dafny( input: &Option, ) -> ::std::rc::Rc< diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs index f5f0f35fbd..54198eafa0 100644 --- a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs +++ b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs @@ -1,3 +1,6 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + // Annotation to ignore the case of this module use crate::r#_Wrappers_Compile; use crate::implementation_from_dafny::UTF8; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs index 245466d839..5b73f4518c 100644 --- a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs +++ b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs @@ -57,18 +57,18 @@ impl Client { } impl crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient for Client { - fn CreateOrphanedResource( + fn CreateOrphanedError( &self, - input: &::std::rc::Rc, + input: &::std::rc::Rc, ) -> std::rc::Rc< crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc, + ::std::rc::Rc, std::rc::Rc, >, >{ - let inner_input = crate::conversions::create_orphaned_resource::_create_orphaned_resource_input::from_dafny(input.clone()); + let inner_input = crate::conversions::create_orphaned_error::_create_orphaned_error_input::from_dafny(input.clone()); let result = tokio::task::block_in_place(|| { - dafny_tokio_runtime.block_on(crate::operation::create_orphaned_resource::CreateOrphanedResource::send(&self.wrapped, inner_input)) + dafny_tokio_runtime.block_on(crate::operation::create_orphaned_error::CreateOrphanedError::send(&self.wrapped, inner_input)) }); match result { Err(error) => ::std::rc::Rc::new( @@ -78,24 +78,24 @@ impl crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient for ), Ok(inner_result) => ::std::rc::Rc::new( crate::_Wrappers_Compile::Result::Success { - value: crate::conversions::create_orphaned_resource::_create_orphaned_resource_output::to_dafny(inner_result), + value: crate::conversions::create_orphaned_error::_create_orphaned_error_output::to_dafny(inner_result), }, ), } } - fn CreateOrphanedError( + fn CreateOrphanedStructure( &self, - input: &::std::rc::Rc, + input: &::std::rc::Rc, ) -> std::rc::Rc< crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc, + ::std::rc::Rc, std::rc::Rc, >, >{ - let inner_input = crate::conversions::create_orphaned_error::_create_orphaned_error_input::from_dafny(input.clone()); + let inner_input = crate::conversions::create_orphaned_structure::_create_orphaned_structure_input::from_dafny(input.clone()); let result = tokio::task::block_in_place(|| { - dafny_tokio_runtime.block_on(crate::operation::create_orphaned_error::CreateOrphanedError::send(&self.wrapped, inner_input)) + dafny_tokio_runtime.block_on(crate::operation::create_orphaned_structure::CreateOrphanedStructure::send(&self.wrapped, inner_input)) }); match result { Err(error) => ::std::rc::Rc::new( @@ -105,24 +105,24 @@ impl crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient for ), Ok(inner_result) => ::std::rc::Rc::new( crate::_Wrappers_Compile::Result::Success { - value: crate::conversions::create_orphaned_error::_create_orphaned_error_output::to_dafny(inner_result), + value: crate::conversions::create_orphaned_structure::_create_orphaned_structure_output::to_dafny(inner_result), }, ), } } - fn CreateOrphanedStructure( + fn CreateOrphanedResource( &self, - input: &::std::rc::Rc, + input: &::std::rc::Rc, ) -> std::rc::Rc< crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc, + ::std::rc::Rc, std::rc::Rc, >, >{ - let inner_input = crate::conversions::create_orphaned_structure::_create_orphaned_structure_input::from_dafny(input.clone()); + let inner_input = crate::conversions::create_orphaned_resource::_create_orphaned_resource_input::from_dafny(input.clone()); let result = tokio::task::block_in_place(|| { - dafny_tokio_runtime.block_on(crate::operation::create_orphaned_structure::CreateOrphanedStructure::send(&self.wrapped, inner_input)) + dafny_tokio_runtime.block_on(crate::operation::create_orphaned_resource::CreateOrphanedResource::send(&self.wrapped, inner_input)) }); match result { Err(error) => ::std::rc::Rc::new( @@ -132,7 +132,7 @@ impl crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient for ), Ok(inner_result) => ::std::rc::Rc::new( crate::_Wrappers_Compile::Result::Success { - value: crate::conversions::create_orphaned_structure::_create_orphaned_structure_output::to_dafny(inner_result), + value: crate::conversions::create_orphaned_resource::_create_orphaned_resource_output::to_dafny(inner_result), }, ), } diff --git a/TestModels/OrphanedShapes/src/Index.dfy b/TestModels/OrphanedShapes/src/Index.dfy index 2fe489ca2f..313241b8d0 100644 --- a/TestModels/OrphanedShapes/src/Index.dfy +++ b/TestModels/OrphanedShapes/src/Index.dfy @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 include "SimpleOrphanedImpl.dfy" -module {:extern "simple.orphaned.internaldafny" } SimpleOrphaned refines AbstractSimpleOrphanedService { +module SimpleOrphaned refines AbstractSimpleOrphanedService { import Operations = SimpleOrphanedImpl function method DefaultSimpleOrphanedConfig(): SimpleOrphanedConfig { diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy index 0c8ccbfe92..c0378f39d2 100644 --- a/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy +++ b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy @@ -2,9 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 include "../Model/SimpleOrphanedTypes.dfy" include "OrphanedResource.dfy" +include "ExternDefinitions.dfy" -module {:extern} SimpleOrphanedImpl refines AbstractSimpleOrphanedOperations { - import OrphanedResource +module SimpleOrphanedImpl refines AbstractSimpleOrphanedOperations { + // import OrphanedResource + // import ExternDefinitions datatype Config = Config type InternalConfig = Config @@ -12,94 +14,49 @@ module {:extern} SimpleOrphanedImpl refines AbstractSimpleOrphanedOperations { {true} function ModifiesInternalConfig(config: InternalConfig) : set {{}} - predicate CreateOrphanedStructureEnsuresPublicly(input: CreateOrphanedStructureInput, output: Result) { - true - } - predicate CreateOrphanedResourceEnsuresPublicly(input: CreateOrphanedResourceInput, output: Result) { - true - } - predicate CreateOrphanedErrorEnsuresPublicly(input: CreateOrphanedErrorInput, output: Result) { - true - } - method CreateOrphanedStructure ( config: InternalConfig, input: CreateOrphanedStructureInput ) - returns (output: Result) - { - // Create Dafny OrphanedStructure. (This implicitly tests Dafny codegen's orphaned shapes generation.) - var uninitializedStructure := Types.OrphanedStructure(); - var initializedStructure := InitializeOrphanedStructure(uninitializedStructure); - - expect initializedStructure.stringValue.Some?; - expect initializedStructure.stringValue.value == "the extern MUST use Smithy-generated conversions to set this value in the native structure"; - - return Success(CreateOrphanedStructureOutput()); - } - - // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. - // This will ensure that OrphanedStructure and its conversions are generated, - // even though OrphanedStructure is "orphaned". - - // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. - // The Smithy model does not know about this operation, - // so it doesn't register OrphanedStructure as an operation shape. - // If this operation were on the Smithy model, - // both the operation and OrphanedStructure would no longer be orphaned, - // and wouldn't be useful in an "orphaned shapes" TestModel. - // Putting all usage of the orphaned shape outside the model's knowledge - // lets us test orphaned shape model/conversion generation. - method {:extern} InitializeOrphanedStructure( input: Types.OrphanedStructure ) - returns (output: Types.OrphanedStructure) - - method CreateOrphanedResource ( config: InternalConfig, input: CreateOrphanedResourceInput ) - returns (output: Result) - { - var resource := new OrphanedResource.OrphanedResource(); - var ret :- CallNativeOrphanedResource(resource); - - expect ret.someString.Some?; - expect ret.someString.value == "correct string"; - - return Success(CreateOrphanedResourceOutput()); - } - - // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. - // This will ensure that OrphanedStructure and its conversions are generated, - // even though OrphanedStructure is "orphaned". - - // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. - // The Smithy model does not know about this operation, - // so it doesn't register OrphanedStructure as an operation shape. - // If this operation were on the Smithy model, - // both the operation and OrphanedStructure would no longer be orphaned, - // and wouldn't be useful in an "orphaned shapes" TestModel. - // Putting all usage of the orphaned shape outside the model's knowledge - // lets us test orphaned shape model/conversion generation. - method {:extern} CallNativeOrphanedResource( input: Types.IOrphanedResource ) - returns (output: Result) - - method CreateOrphanedError ( config: InternalConfig, input: CreateOrphanedErrorInput ) - returns (output: Result) - { - var error := Types.Error.OrphanedError(message := "TBD"); - var out_error := CallNativeOrphanedError(error); - - expect out_error.OrphanedError?; - expect out_error.message == "the extern MUST use Smithy-generated conversions to set this value in the native error"; - - return Success(CreateOrphanedErrorOutput()); - } - - // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. - // This will ensure that OrphanedStructure and its conversions are generated, - // even though OrphanedStructure is "orphaned". - - // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. - // The Smithy model does not know about this operation, - // so it doesn't register OrphanedStructure as an operation shape. - // If this operation were on the Smithy model, - // both the operation and OrphanedStructure would no longer be orphaned, - // and wouldn't be useful in an "orphaned shapes" TestModel. - // Putting all usage of the orphaned shape outside the model's knowledge - // lets us test orphaned shape model/conversion generation. - method {:extern} CallNativeOrphanedError( input: Types.Error ) - returns (output: Types.Error ) + // predicate CreateOrphanedStructureEnsuresPublicly(input: CreateOrphanedStructureInput, output: Result) { + // true + // } + // predicate CreateOrphanedResourceEnsuresPublicly(input: CreateOrphanedResourceInput, output: Result) { + // true + // } + // predicate CreateOrphanedErrorEnsuresPublicly(input: CreateOrphanedErrorInput, output: Result) { + // true + // } + // method CreateOrphanedStructure ( config: InternalConfig, input: CreateOrphanedStructureInput ) + // returns (output: Result) + // { + // // Create Dafny OrphanedStructure. (This implicitly tests Dafny codegen's orphaned shapes generation.) + // var uninitializedStructure := Types.OrphanedStructure(); + // var initializedStructure := ExternDefinitions.InitializeOrphanedStructure(uninitializedStructure); + + // expect initializedStructure.stringValue.Some?; + // expect initializedStructure.stringValue.value == "the extern MUST use Smithy-generated conversions to set this value in the native structure"; + + // return Success(CreateOrphanedStructureOutput()); + // } + + // method CreateOrphanedResource ( config: InternalConfig, input: CreateOrphanedResourceInput ) + // returns (output: Result) + // { + // var resource := new OrphanedResource.OrphanedResource(); + // var ret :- ExternDefinitions.CallNativeOrphanedResource(resource); + + // expect ret.someString.Some?; + // expect ret.someString.value == "correct string"; + + // return Success(CreateOrphanedResourceOutput()); + // } + + // method CreateOrphanedError ( config: InternalConfig, input: CreateOrphanedErrorInput ) + // returns (output: Result) + // { + // var error := Types.Error.OrphanedError(message := "TBD"); + // var out_error := ExternDefinitions.CallNativeOrphanedError(error); + + // expect out_error.OrphanedError?; + // expect out_error.message == "the extern MUST use Smithy-generated conversions to set this value in the native error"; + + // return Success(CreateOrphanedErrorOutput()); + // } } \ No newline at end of file diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy deleted file mode 100644 index d02db0b1a2..0000000000 --- a/TestModels/OrphanedShapes/src/SimpleOrphanedShapesImpl.dfy +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -include "../Model/SimplePositionalTypes.dfy" -include "./SimpleResource.dfy" -module SimplePositionalImpl refines AbstractSimplePositionalOperations { - import SimpleResource - - datatype Config = Config - type InternalConfig = Config - - predicate ValidInternalConfig?(config: InternalConfig) - {true} - function ModifiesInternalConfig(config: InternalConfig): set - {{}} - predicate GetResourceEnsuresPublicly(input: GetResourceInput , output: Result) - {true} - - - - method GetResource ( config: InternalConfig , input: GetResourceInput ) - returns (output: Result) - - { - var resource := new SimpleResource.SimpleResource( - input.name - ); - var result: GetResourceOutput := GetResourceOutput( - output := resource - ); - return Success(result); - } - - - predicate GetResourcePositionalEnsuresPublicly(input: string , output: Result) - {true} - - - - // @positional allows use to accept the input parameters directly without the input structure - method GetResourcePositional ( config: InternalConfig , input: string ) - returns (output: Result) - - { - var resource := new SimpleResource.SimpleResource(input); - - // @positional allows use to return the result without the output structure - return Success(resource); - } -} diff --git a/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy index db9896c073..004426c051 100644 --- a/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy +++ b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 include "../Model/SimpleOrphanedTypesWrapped.dfy" -module {:options "--function-syntax:4"} {:extern "simple.orphaned.internaldafny.wrapped"} WrappedSimpleOrphanedService refines WrappedAbstractSimpleOrphanedService { +module {:options "--function-syntax:4"} WrappedSimpleOrphanedService refines WrappedAbstractSimpleOrphanedService { import WrappedService = SimpleOrphaned function WrappedDefaultSimpleOrphanedConfig(): SimpleOrphanedConfig { SimpleOrphanedConfig diff --git a/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy b/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy deleted file mode 100644 index fb1241511d..0000000000 --- a/TestModels/OrphanedShapes/test/OrphanedShapesTest.dfy +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -include "../src/Index.dfy" -include "./Helpers.dfy" -include "../src/MutableResource.dfy" - -module SimpleResourcesTest { - import SimpleResources - import Types = SimpleResourcesTypes - import opened Wrappers - import opened Helpers - - method TestNoneGetData( - config: Types.SimpleResourcesConfig, - resource: Types.ISimpleResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allNone(); - var result :- expect resource.GetResourceData(input); - checkMostNone(config.name, result); - } - - method TestSomeGetData( - config: Types.SimpleResourcesConfig, - resource: Types.ISimpleResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allSome(); - var output :- expect resource.GetResourceData(input); - checkSome(config.name, output); - } - - method TestGetResources( - config: Types.SimpleResourcesConfig, - client: Types.ISimpleResourcesClient - ) returns ( - resource: Types.ISimpleResource - ) - requires client.ValidState() - modifies client.Modifies - ensures client.ValidState() - ensures resource.Modifies !! {client.History} - ensures fresh(resource.Modifies - client.Modifies - {client.History} ) - ensures resource.ValidState() && fresh(resource) - { - var input := Types.GetResourcesInput( - value := Some("Test") - ); - var output :- expect client.GetResources(input); - return output.output; - } - - method TestClient(config: Types.SimpleResourcesConfig) - { - var client :- expect SimpleResources.SimpleResources(config); - var resource := TestGetResources(config, client); - TestNoneGetData(config, resource); - TestSomeGetData(config, resource); - - var mutableResource := TestGetMutableResources(config, client); - TestMutableNoneGetData(config, mutableResource); - TestMutableSomeGetData(config, mutableResource); - } - - method {:test} TestDefaultConfig() - { - TestClient(SimpleResources.DefaultSimpleResourcesConfig()); - } - - method {:test} TestCustomConfig() - { - TestClient(Types.SimpleResourcesConfig(name := "Dafny")); - } - - // This is breaking encapsulation - // this is not something for public clients to do. - // this is to access the internal state and verify that specific things are true/false. - import MutableResource = MutableResource`ForTesting - - method TestMutableNoneGetData( - config: Types.SimpleResourcesConfig, - resource: Types.IMutableResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allMutableNone(); - - expect resource is MutableResource.MutableResource; - var test:MutableResource.MutableResource := resource; - - var before := test.MyInternalState; - - var result :- expect resource.GetMutableResourceData(input); - checkMutableMostNone(config.name, result); - - // This sort of things SHOULD NOT be able to be proved. - // Dafny does not have a way to say `assert something is impossible to prove;` - // assert before != test.MyInternalState; - - // This is assuming that everything verifies - // Given that, the Dafny in MutableResource - // was able to prove MutableResource, - // and the Types file was correct - // This is a basic check to make sure - // that this simplified separated class works. - expect before + 1 == test.MyInternalState; - } - - method TestMutableSomeGetData( - config: Types.SimpleResourcesConfig, - resource: Types.IMutableResource - ) - requires resource.ValidState() - modifies resource.Modifies - ensures resource.ValidState() - { - var input := allMutableSome(); - var output :- expect resource.GetMutableResourceData(input); - checkMutableSome(config.name, output); - } - - method TestGetMutableResources( - config: Types.SimpleResourcesConfig, - client: Types.ISimpleResourcesClient - ) returns ( - resource: Types.IMutableResource - ) - requires client.ValidState() - modifies client.Modifies - ensures client.ValidState() - ensures resource.Modifies !! {client.History} - ensures fresh(resource.Modifies - client.Modifies - {client.History} ) - ensures resource.ValidState() && fresh(resource) - { - var input := Types.GetMutableResourcesInput( - value := Some("Test") - ); - var output :- expect client.GetMutableResources(input); - return output.output; - } - -} diff --git a/TestModels/OrphanedShapes/test/WrappedTest.dfy b/TestModels/OrphanedShapes/test/WrappedTest.dfy index 1d478f3571..f9c6a493a2 100644 --- a/TestModels/OrphanedShapes/test/WrappedTest.dfy +++ b/TestModels/OrphanedShapes/test/WrappedTest.dfy @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 include "../src/WrappedSimpleOrphanedImpl.dfy" +include "ExternDefinitions.dfy" // There are no non-wrapped tests for this TestModel. // This TestModel requires implementing externs that call Polymorph-generated code. @@ -10,39 +11,29 @@ include "../src/WrappedSimpleOrphanedImpl.dfy" module WrappedTest { import WrappedSimpleOrphanedService import opened Types = SimpleOrphanedTypes + import ExternDefinitions - method {:test} TestWrappedClient() - { - var client :- expect WrappedSimpleOrphanedService.WrappedSimpleOrphaned(); - TestCreateOrphanedStructure(client); - TestCreateOrphanedResource(client); - TestCreateOrphanedError(client); - } + // method {:test} TestWrappedClient() + // { + // // ExternDefinitions.TestOrphanedStructure(); + // ExternDefinitions.TestOrphanedResource(); + // // ExternDefinitions.TestOrphanedError(); + + // // var client :- expect WrappedSimpleOrphanedService.WrappedSimpleOrphaned(); + // // TestCreateOrphanedStructure(client); + // // TestCreateOrphanedResource(client); + // // TestCreateOrphanedError(client); + // } - method TestCreateOrphanedStructure(client: Types.ISimpleOrphanedClient) - requires client.ValidState() - modifies client.Modifies - ensures client.ValidState() - { - var ret := client.CreateOrphanedStructure(Types.CreateOrphanedStructureInput); - expect ret.Success?; + method {:test} TestOrphanedStructure() { + ExternDefinitions.TestOrphanedStructure(); } - method TestCreateOrphanedResource(client: Types.ISimpleOrphanedClient) - requires client.ValidState() - modifies client.Modifies - ensures client.ValidState() - { - var ret := client.CreateOrphanedResource(Types.CreateOrphanedResourceInput); - expect ret.Success?; + method {:test} TestOrphanedResource() { + ExternDefinitions.TestOrphanedResource(); } - method TestCreateOrphanedError(client: Types.ISimpleOrphanedClient) - requires client.ValidState() - modifies client.Modifies - ensures client.ValidState() - { - var ret := client.CreateOrphanedError(Types.CreateOrphanedErrorInput); - expect ret.Success?; + method {:test} TestOrphanedError() { + ExternDefinitions.TestOrphanedError(); } } diff --git a/TestModels/RecursiveShape/Model/RecursiveShape.smithy b/TestModels/RecursiveShape/Model/RecursiveShape.smithy index ab2cb7ae2d..a99ec2db23 100644 --- a/TestModels/RecursiveShape/Model/RecursiveShape.smithy +++ b/TestModels/RecursiveShape/Model/RecursiveShape.smithy @@ -9,7 +9,7 @@ namespace simple.recursiveShape service SimpleRecursiveShape { version: "2021-11-01", resources: [], - operations: [ GetRecursiveShape ], + operations: [ GetRecursiveShape, GetRecursiveStructure ], errors: [], } @@ -20,6 +20,11 @@ operation GetRecursiveShape { output: GetRecursiveShapeOutput, } +operation GetRecursiveStructure { + input: StructureWithRecursionOne, + output: StructureWithRecursionOne, +} + structure GetRecursiveShapeInput { recursiveUnion: RecursiveUnion } @@ -45,4 +50,12 @@ map MapWithRecursion { structure StructureWithRecursion { content: RecursiveUnion +} + +structure StructureWithRecursionOne { + content: StructureWithRecursionTwo +} + +structure StructureWithRecursionTwo { + content: StructureWithRecursionOne } \ No newline at end of file diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/extern/wrapped_simple_blob.py b/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/extern/wrapped_simple_blob.py index b6172afab0..3d25facaa1 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/extern/wrapped_simple_blob.py +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/extern/wrapped_simple_blob.py @@ -4,12 +4,15 @@ # src imports from simple_types_blob.smithygenerated.simple_types_blob.client import SimpleTypesBlob from simple_types_blob.smithygenerated.simple_types_blob.shim import SimpleBlobShim -from simple_types_blob.smithygenerated.simple_types_blob.config import dafny_config_to_smithy_config +from simple_types_blob.smithygenerated.simple_types_blob.config import ( + dafny_config_to_smithy_config, +) import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers # test imports, not qualified since this isn't in a package import WrappedSimpleTypesBlobService + class default__(WrappedSimpleTypesBlobService.default__): @staticmethod @@ -19,4 +22,5 @@ def WrappedSimpleBlob(config): wrapped_client = SimpleBlobShim(impl) return Wrappers.Result_Success(wrapped_client) + WrappedSimpleTypesBlobService.default__ = default__ diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/test_dafny_wrapper.py b/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/test_dafny_wrapper.py index 12c830fb4c..bc7aa6a427 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/test_dafny_wrapper.py +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/test_dafny_wrapper.py @@ -1,5 +1,5 @@ -""" -Wrapper file for executing Dafny tests from pytest. +"""Wrapper file for executing Dafny tests from pytest. + This allows us to import modules required by Dafny-generated tests before executing Dafny-generated tests. pytest will find and execute the `test_dafny` method below, @@ -12,7 +12,7 @@ # and require adding Dafny-generated test code to PYTHONPATH. # These files are only on PYTHONPATH for tests executed from this file. -internaldafny_dir = '/'.join(__file__.split("/")[:-1]) +internaldafny_dir = "/".join(__file__.split("/")[:-1]) sys.path.append(internaldafny_dir + "/extern") sys.path.append(internaldafny_dir + "/generated") @@ -20,5 +20,6 @@ # Initialize extern for test from .extern import wrapped_simple_blob + def test_dafny(): - from .generated import __main__ \ No newline at end of file + from .generated import __main__ diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceDirectedCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceDirectedCodegen.java index e470c92eea..0cbb0f2bb6 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceDirectedCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceDirectedCodegen.java @@ -213,7 +213,11 @@ protected void generateOrphanedShapesForService( ShapeType.INTEGER, ShapeType.UNION, ShapeType.STRING, - ShapeType.LONG + ShapeType.LONG, + ShapeType.BLOB, + ShapeType.BOOLEAN, + ShapeType.LIST, + ShapeType.MAP ); for (final var shapeToGenerate : orderedShapes) { diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java index 7933798962..b35fe295c5 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java @@ -7,6 +7,8 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.Set; +import java.util.stream.Collectors; + import software.amazon.polymorph.smithygo.codegen.ApplicationProtocol; import software.amazon.polymorph.smithygo.codegen.GenerationContext; import software.amazon.polymorph.smithygo.codegen.GoDelegator; @@ -24,6 +26,7 @@ import software.amazon.polymorph.traits.LocalServiceTrait; import software.amazon.polymorph.traits.PositionalTrait; import software.amazon.polymorph.traits.ReferenceTrait; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.aws.traits.ServiceTrait; import software.amazon.smithy.codegen.core.Symbol; import software.amazon.smithy.model.shapes.OperationShape; @@ -1066,6 +1069,13 @@ func OpaqueError_Input_ToDafny(nativeInput $L.OpaqueError)($L.Error) { } ); + Set errorShapesForNamespace = context.model().getStructureShapes() + .stream() + .filter(shape -> shape.hasTrait(ErrorTrait.class)) + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), context.settings().getService(context.model()))) + .collect(Collectors.toSet()); + context .writerDelegator() .useFileWriter( @@ -1103,7 +1113,8 @@ func Error_ToDafny(err error)($L.Error) { """, DafnyNameResolver.dafnyTypesNamespace(serviceShape), writer.consumer(w -> { - for (var error : serviceShape.getErrors()) { + for (var errorShape : errorShapesForNamespace) { + var error = errorShape.getId(); w.write( """ case $L: @@ -1424,6 +1435,13 @@ func OpaqueError_Output_FromDafny(dafnyOutput $L.Error)($L.OpaqueError) { } ); + Set errorShapesForNamespace = context.model().getStructureShapes() + .stream() + .filter(shape -> shape.hasTrait(ErrorTrait.class)) + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), context.settings().getService(context.model()))) + .collect(Collectors.toSet()); + context .writerDelegator() .useFileWriter( @@ -1456,7 +1474,8 @@ func Error_FromDafny(err $L.Error)(error) { """, DafnyNameResolver.dafnyTypesNamespace(serviceShape), writer.consumer(w -> { - for (final var error : serviceShape.getErrors()) { + for (final var errorShape : errorShapesForNamespace) { + var error = errorShape.getId(); w.write( """ if err.Is_$L() { From fd8164cc107ddddadd299388fb2abbcf44ee67dd Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 11:29:42 -0800 Subject: [PATCH 14/32] m --- TestModels/OrphanedShapes/src/Index.dfy | 2 +- .../src/WrappedSimpleOrphanedImpl.dfy | 2 +- ...irectedDafnyPythonLocalServiceCodegen.java | 21 +++++++------------ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/TestModels/OrphanedShapes/src/Index.dfy b/TestModels/OrphanedShapes/src/Index.dfy index 313241b8d0..2fe489ca2f 100644 --- a/TestModels/OrphanedShapes/src/Index.dfy +++ b/TestModels/OrphanedShapes/src/Index.dfy @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 include "SimpleOrphanedImpl.dfy" -module SimpleOrphaned refines AbstractSimpleOrphanedService { +module {:extern "simple.orphaned.internaldafny" } SimpleOrphaned refines AbstractSimpleOrphanedService { import Operations = SimpleOrphanedImpl function method DefaultSimpleOrphanedConfig(): SimpleOrphanedConfig { diff --git a/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy index 004426c051..db9896c073 100644 --- a/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy +++ b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 include "../Model/SimpleOrphanedTypesWrapped.dfy" -module {:options "--function-syntax:4"} WrappedSimpleOrphanedService refines WrappedAbstractSimpleOrphanedService { +module {:options "--function-syntax:4"} {:extern "simple.orphaned.internaldafny.wrapped"} WrappedSimpleOrphanedService refines WrappedAbstractSimpleOrphanedService { import WrappedService = SimpleOrphaned function WrappedDefaultSimpleOrphanedConfig(): SimpleOrphanedConfig { SimpleOrphanedConfig diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 09fb4dfe62..ddffa91e86 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -515,26 +515,19 @@ protected void generateOrphanedShapesForService( directive.context() ); } else if (shapeToGenerate.isStringShape()) { - // Neither classes nor conversions are generated for strings - continue; + // Neither classes nor converisons are generated for strings } else if (shapeToGenerate.isIntegerShape()) { - // Neither classes nor conversions are generated for ints - continue; + // Neither classes nor converisons are generated for ints } else if (shapeToGenerate.isListShape()) { - // Neither classes nor conversions are generated for lists - continue; + // Neither classes nor converisons are generated for lists } else if (shapeToGenerate.isMapShape()) { - // Neither classes nor conversions are generated for maps - continue; + // Neither classes nor converisons are generated for maps } else if (shapeToGenerate.isLongShape()) { - // Neither classes nor conversions are generated for longs - continue; + // Neither classes nor converisons are generated for longs } else if (shapeToGenerate.isBlobShape()) { - // Neither classes nor conversions are generated for blobs - continue; + // Neither classes nor converisons are generated for blobs } else if (shapeToGenerate.isBooleanShape()) { - // Neither classes nor conversions are generated for booleans - continue; + // Neither classes nor converisons are generated for blobs } else { // Add more as needed... throw new ClassCastException( From 20a00f7f43ccd7a4d281b1367e7fc47b8c3b7b4a Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 11:30:41 -0800 Subject: [PATCH 15/32] m --- .../Model/OrphanedShapes.smithy | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy index e51946e51e..e04cd63751 100644 --- a/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy +++ b/TestModels/OrphanedShapes/Model/OrphanedShapes.smithy @@ -11,11 +11,7 @@ namespace simple.orphaned service SimpleOrphaned { version: "2021-11-01", resources: [], - operations: [ - // CreateOrphanedStructure, - // CreateOrphanedResource, - // CreateOrphanedError, - ], + operations: [], } structure SimpleOrphanedConfig { @@ -132,30 +128,3 @@ structure OrphanedResourceOperationInput { structure OrphanedResourceOperationOutput { someString: String } - -operation CreateOrphanedStructure { - input: CreateOrphanedStructureInput - output: CreateOrphanedStructureOutput -} - -structure CreateOrphanedStructureInput {} - -structure CreateOrphanedStructureOutput {} - -operation CreateOrphanedResource { - input: CreateOrphanedResourceInput - output: CreateOrphanedResourceOutput -} - -structure CreateOrphanedResourceInput {} - -structure CreateOrphanedResourceOutput {} - -operation CreateOrphanedError { - input: CreateOrphanedErrorInput - output: CreateOrphanedErrorOutput -} - -structure CreateOrphanedErrorInput {} - -structure CreateOrphanedErrorOutput {} From 6816df5c50e59d74a9c9afc242afe7e462e57735 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 11:37:30 -0800 Subject: [PATCH 16/32] m --- TestModels/.gitignore | 19 +++++ .../OrphanedShapes/src/ExternDefinitions.dfy | 56 +++++++++++++ .../OrphanedShapes/test/ExternDefinitions.dfy | 83 +++++++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 TestModels/OrphanedShapes/src/ExternDefinitions.dfy create mode 100644 TestModels/OrphanedShapes/test/ExternDefinitions.dfy diff --git a/TestModels/.gitignore b/TestModels/.gitignore index 370617fd88..4b47e7e4b0 100644 --- a/TestModels/.gitignore +++ b/TestModels/.gitignore @@ -46,6 +46,25 @@ **/runtimes/python/poetry.lock **/runtimes/python/**/poetry.lock +# Rust Artifacts +Cargo.lock +src/client.rs +src/client +src/conversions.rs +src/conversions +src/deps.rs +src/deps +src/error.rs +src/error +src/implementation_from_dafny.rs +src/operation.rs +src/operation +src/standard_library_conversions.rs +src/standard_library_externs.rs +src/types.rs +src/types +target + # JetBrains **/.idea/ **/Folder.DotSettings.user diff --git a/TestModels/OrphanedShapes/src/ExternDefinitions.dfy b/TestModels/OrphanedShapes/src/ExternDefinitions.dfy new file mode 100644 index 0000000000..f5c8d9dd6c --- /dev/null +++ b/TestModels/OrphanedShapes/src/ExternDefinitions.dfy @@ -0,0 +1,56 @@ +// include "../Model/SimpleOrphanedTypes.dfy" + +// module ExternDefinitions { + +// import opened Wrappers +// import Types = SimpleOrphanedTypes + +// // Dafny-Go compiler maybe-bug: +// // A module needs at least one non-extern method for the Dafny-Go compiler generate the CompanionStruct_Default___ type +// method EmptyMethod() { } + +// // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. +// // This will ensure that OrphanedStructure and its conversions are generated, +// // even though OrphanedStructure is "orphaned". + +// // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. +// // The Smithy model does not know about this operation, +// // so it doesn't register OrphanedStructure as an operation shape. +// // If this operation were on the Smithy model, +// // both the operation and OrphanedStructure would no longer be orphaned, +// // and wouldn't be useful in an "orphaned shapes" TestModel. +// // Putting all usage of the orphaned shape outside the model's knowledge +// // lets us test orphaned shape model/conversion generation. +// method {:extern} InitializeOrphanedStructure( input: Types.OrphanedStructure ) +// returns (output: Types.OrphanedStructure) + +// // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. +// // This will ensure that OrphanedStructure and its conversions are generated, +// // even though OrphanedStructure is "orphaned". + +// // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. +// // The Smithy model does not know about this operation, +// // so it doesn't register OrphanedStructure as an operation shape. +// // If this operation were on the Smithy model, +// // both the operation and OrphanedStructure would no longer be orphaned, +// // and wouldn't be useful in an "orphaned shapes" TestModel. +// // Putting all usage of the orphaned shape outside the model's knowledge +// // lets us test orphaned shape model/conversion generation. +// method {:extern} CallNativeOrphanedResource( input: Types.IOrphanedResource ) +// returns (output: Result) + +// // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. +// // This will ensure that OrphanedStructure and its conversions are generated, +// // even though OrphanedStructure is "orphaned". + +// // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. +// // The Smithy model does not know about this operation, +// // so it doesn't register OrphanedStructure as an operation shape. +// // If this operation were on the Smithy model, +// // both the operation and OrphanedStructure would no longer be orphaned, +// // and wouldn't be useful in an "orphaned shapes" TestModel. +// // Putting all usage of the orphaned shape outside the model's knowledge +// // lets us test orphaned shape model/conversion generation. +// method {:extern} CallNativeOrphanedError( input: Types.Error ) +// returns (output: Types.Error ) +// } \ No newline at end of file diff --git a/TestModels/OrphanedShapes/test/ExternDefinitions.dfy b/TestModels/OrphanedShapes/test/ExternDefinitions.dfy new file mode 100644 index 0000000000..1b28a46315 --- /dev/null +++ b/TestModels/OrphanedShapes/test/ExternDefinitions.dfy @@ -0,0 +1,83 @@ +include "../Model/SimpleOrphanedTypes.dfy" +include "../src/OrphanedResource.dfy" + +module ExternDefinitions { + + import opened Wrappers + import Types = SimpleOrphanedTypes + import OrphanedResource + + method TestOrphanedStructure () + { + // Create Dafny OrphanedStructure. (This implicitly tests Dafny codegen's orphaned shapes generation.) + var uninitializedStructure := Types.OrphanedStructure(); + var initializedStructure := InitializeOrphanedStructure(uninitializedStructure); + + expect initializedStructure.stringValue.Some?; + expect initializedStructure.stringValue.value == "the extern MUST use Smithy-generated conversions to set this value in the native structure"; + } + + method TestOrphanedResource () + { + var resource := new OrphanedResource.OrphanedResource(); + var ret := CallNativeOrphanedResource(resource); + + expect ret.Success?; + expect ret.value.someString.Some?; + expect ret.value.someString.value == "correct string"; + } + + method TestOrphanedError () + { + var error := Types.Error.OrphanedError(message := "TBD"); + var out_error := CallNativeOrphanedError(error); + + expect out_error.OrphanedError?; + expect out_error.message == "the extern MUST use Smithy-generated conversions to set this value in the native error"; + } + + // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. + // This will ensure that OrphanedStructure and its conversions are generated, + // even though OrphanedStructure is "orphaned". + + // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. + // The Smithy model does not know about this operation, + // so it doesn't register OrphanedStructure as an operation shape. + // If this operation were on the Smithy model, + // both the operation and OrphanedStructure would no longer be orphaned, + // and wouldn't be useful in an "orphaned shapes" TestModel. + // Putting all usage of the orphaned shape outside the model's knowledge + // lets us test orphaned shape model/conversion generation. + method {:extern} InitializeOrphanedStructure( input: Types.OrphanedStructure ) + returns (output: Types.OrphanedStructure) + + // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. + // This will ensure that OrphanedStructure and its conversions are generated, + // even though OrphanedStructure is "orphaned". + + // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. + // The Smithy model does not know about this operation, + // so it doesn't register OrphanedStructure as an operation shape. + // If this operation were on the Smithy model, + // both the operation and OrphanedStructure would no longer be orphaned, + // and wouldn't be useful in an "orphaned shapes" TestModel. + // Putting all usage of the orphaned shape outside the model's knowledge + // lets us test orphaned shape model/conversion generation. + method {:extern} CallNativeOrphanedResource( input: Types.IOrphanedResource ) + returns (output: Result) + + // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. + // This will ensure that OrphanedStructure and its conversions are generated, + // even though OrphanedStructure is "orphaned". + + // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. + // The Smithy model does not know about this operation, + // so it doesn't register OrphanedStructure as an operation shape. + // If this operation were on the Smithy model, + // both the operation and OrphanedStructure would no longer be orphaned, + // and wouldn't be useful in an "orphaned shapes" TestModel. + // Putting all usage of the orphaned shape outside the model's knowledge + // lets us test orphaned shape model/conversion generation. + method {:extern} CallNativeOrphanedError( input: Types.Error ) + returns (output: Types.Error ) +} \ No newline at end of file From 8aae7198c4d240d39feacd30bdfbbd778a467632 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 11:40:15 -0800 Subject: [PATCH 17/32] m --- .../ExternDefinitions/ExternDefinitions.go | 68 + .../ExternDefinitions/extern.go | 22 + .../ImplementationFromDafny-go.dtr | 20 + .../ImplementationFromDafny.go | 29 + .../OrphanedResource/OrphanedResource.go | 108 + .../SimpleOrphaned/SimpleOrphaned.go | 152 ++ .../SimpleOrphanedImpl/SimpleOrphanedImpl.go | 132 ++ .../SimpleOrphanedTypes.go | 2046 +++++++++++++++++ .../WrappedSimpleOrphanedService/shim.go | 23 + .../go/ImplementationFromDafny-go/go.mod | 10 + .../go/ImplementationFromDafny-go/shim.go | 52 + .../OrphanedResource.go | 25 + .../OrphanedResourceNativeWrapper.go | 23 + .../api_client.go | 24 + .../simpleorphanedsmithygenerated/to_dafny.go | 128 ++ .../to_native.go | 156 ++ .../enums.go | 19 + .../errors.go | 17 + .../types.go | 177 ++ .../unmodelled_errors.go | 26 + .../ExternDefinitions/ExternDefinitions.go | 129 ++ .../ExternDefinitions/extern.go | 40 + .../TestsFromDafny-go/TestsFromDafny-go.dtr | 14 + .../go/TestsFromDafny-go/TestsFromDafny.go | 144 ++ .../WrappedSimpleOrphanedService.go | 73 + .../WrappedSimpleOrphanedService/shim.go | 23 + .../WrappedTest/WrappedTest.go | 83 + .../runtimes/go/TestsFromDafny-go/go.mod | 14 + .../runtimes/go/TestsFromDafny-go/go.sum | 2 + .../runtimes/go/TestsFromDafny-go/shim.go | 52 + .../OrphanedResource.go | 25 + .../OrphanedResourceNativeWrapper.go | 23 + .../api_client.go | 24 + .../simpleorphanedsmithygenerated/to_dafny.go | 128 ++ .../to_native.go | 156 ++ .../enums.go | 19 + .../errors.go | 17 + .../types.go | 177 ++ .../unmodelled_errors.go | 26 + .../runtimes/rust/src/client.rs | 38 - .../rust/src/client/create_orphaned_error.rs | 15 - .../src/client/create_orphaned_resource.rs | 15 - .../src/client/create_orphaned_structure.rs | 15 - .../runtimes/rust/src/conversions.rs | 42 - .../runtimes/rust/src/conversions/client.rs | 24 - .../src/conversions/create_orphaned_error.rs | 7 - .../_create_orphaned_error_input.rs | 24 - .../_create_orphaned_error_output.rs | 24 - .../create_orphaned_error_input.rs | 70 - .../create_orphaned_error_output.rs | 70 - .../conversions/create_orphaned_resource.rs | 7 - .../_create_orphaned_resource_input.rs | 24 - .../_create_orphaned_resource_output.rs | 24 - .../create_orphaned_resource_input.rs | 70 - .../create_orphaned_resource_output.rs | 70 - .../conversions/create_orphaned_structure.rs | 7 - .../_create_orphaned_structure_input.rs | 24 - .../_create_orphaned_structure_output.rs | 24 - .../create_orphaned_structure_input.rs | 70 - .../create_orphaned_structure_output.rs | 70 - .../runtimes/rust/src/conversions/error.rs | 125 - .../src/conversions/orphaned_config_shape.rs | 70 - .../rust/src/conversions/orphaned_resource.rs | 97 - .../orphaned_resource_operation.rs | 7 - .../_orphaned_resource_operation_input.rs | 24 - .../_orphaned_resource_operation_output.rs | 24 - .../orphaned_resource_operation_input.rs | 70 - .../orphaned_resource_operation_output.rs | 70 - .../src/conversions/orphaned_structure.rs | 142 -- .../rust/src/conversions/orphaned_union.rs | 37 - .../rust/src/conversions/orphaned_v1_enum.rs | 25 - .../src/conversions/simple_orphaned_config.rs | 4 - .../_simple_orphaned_config.rs | 53 - .../OrphanedShapes/runtimes/rust/src/deps.rs | 3 - .../OrphanedShapes/runtimes/rust/src/error.rs | 16 - .../rust/src/error/sealed_unhandled.rs | 32 - .../runtimes/rust/src/operation.rs | 14 - .../src/operation/create_orphaned_error.rs | 49 - .../_create_orphaned_error_input.rs | 41 - .../_create_orphaned_error_output.rs | 41 - .../create_orphaned_error/builders.rs | 65 - .../src/operation/create_orphaned_resource.rs | 49 - .../_create_orphaned_resource_input.rs | 41 - .../_create_orphaned_resource_output.rs | 41 - .../create_orphaned_resource/builders.rs | 65 - .../operation/create_orphaned_structure.rs | 49 - .../_create_orphaned_structure_input.rs | 41 - .../_create_orphaned_structure_output.rs | 41 - .../create_orphaned_structure/builders.rs | 65 - .../operation/orphaned_resource_operation.rs | 35 - .../_orphaned_resource_operation_input.rs | 58 - .../_orphaned_resource_operation_output.rs | 58 - .../orphaned_resource_operation/builders.rs | 78 - .../rust/src/standard_library_conversions.rs | 269 --- .../rust/src/standard_library_externs.rs | 83 - .../OrphanedShapes/runtimes/rust/src/types.rs | 39 - .../src/types/_create_orphaned_error_input.rs | 41 - .../types/_create_orphaned_error_output.rs | 41 - .../types/_create_orphaned_resource_input.rs | 41 - .../types/_create_orphaned_resource_output.rs | 41 - .../types/_create_orphaned_structure_input.rs | 41 - .../_create_orphaned_structure_output.rs | 41 - .../rust/src/types/_orphaned_config_shape.rs | 58 - .../_orphaned_resource_operation_input.rs | 58 - .../_orphaned_resource_operation_output.rs | 58 - .../rust/src/types/_orphaned_structure.rs | 234 -- .../rust/src/types/_orphaned_union.rs | 53 - .../rust/src/types/_orphaned_v1_enum.rs | 20 - .../runtimes/rust/src/types/builders.rs | 22 - .../runtimes/rust/src/types/error.rs | 72 - .../rust/src/types/orphaned_resource.rs | 40 - .../orphaned_resource_operation.rs | 15 - .../rust/src/types/simple_orphaned_config.rs | 58 - 113 files changed, 4426 insertions(+), 3689 deletions(-) create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/ExternDefinitions.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/extern.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/OrphanedResource/OrphanedResource.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphaned/SimpleOrphaned.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedImpl/SimpleOrphanedImpl.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedTypes/SimpleOrphanedTypes.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/WrappedSimpleOrphanedService/shim.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/go.mod create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/shim.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/api_client.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_native.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/ExternDefinitions.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny-go.dtr create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/WrappedSimpleOrphanedService.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/shim.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedTest/WrappedTest.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.mod create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.sum create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/shim.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/api_client.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_native.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go create mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/client.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_error.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_resource.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_structure.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/client.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/error.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_config_shape.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_structure.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_union.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_v1_enum.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config/_simple_orphaned_config.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/deps.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/error.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/error/sealed_unhandled.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/builders.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/builders.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/builders.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/builders.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_config_shape.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_input.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_output.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_structure.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_union.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_v1_enum.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/builders.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/error.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource/orphaned_resource_operation.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/types/simple_orphaned_config.rs diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/ExternDefinitions.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/ExternDefinitions.go new file mode 100644 index 0000000000..34c7f8949b --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/ExternDefinitions.go @@ -0,0 +1,68 @@ +// Package ExternDefinitions +// Dafny module ExternDefinitions compiled into Go + +package ExternDefinitions + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" + m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_SimpleOrphanedTypes.Dummy__ +var _ m_OrphanedResource.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "ExternDefinitions.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) EmptyMethod() { +} + +// End of class Default__ diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/extern.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/extern.go new file mode 100644 index 0000000000..162cf0d358 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/extern.go @@ -0,0 +1,22 @@ +package ExternDefinitions + +import ( + Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" + SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" +) + +var _ Wrappers.Dummy__ + +func (CompanionStruct_Default___) InitializeOrphanedStructure(input SimpleOrphanedTypes.OrphanedStructure) SimpleOrphanedTypes.OrphanedStructure { + return input +} + +func (CompanionStruct_Default___) CallNativeOrphanedResource(input *OrphanedResource.OrphanedResource) Wrappers.Result { + OrphanedResource_FromDafny(input) + return Wrappers.Result_Success(input) +} + +func (CompanionStruct_Default___) CallNativeOrphanedError(input SimpleOrphanedTypes.Error) SimpleOrphanedTypes.Error { + return input +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr new file mode 100644 index 0000000000..8f4082b933 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr @@ -0,0 +1,20 @@ +file_format_version = "1.0" +dafny_version = "4.9.0.0" +[options_by_module.SimpleOrphanedTypes] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" +legacy-module-names = false +[options_by_module.AbstractSimpleOrphanedOperations] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" +legacy-module-names = false +[options_by_module.AbstractSimpleOrphanedService] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" +legacy-module-names = false +[options_by_module.SimpleOrphanedImpl] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" +legacy-module-names = false +[options_by_module.SimpleOrphaned] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" +legacy-module-names = false +[options_by_module.OrphanedResource] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" +legacy-module-names = false diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny.go new file mode 100644 index 0000000000..888cd717af --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny.go @@ -0,0 +1,29 @@ +// Dafny program the_program compiled into Go +package the_program + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" + m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" + m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" + m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_SimpleOrphanedTypes.Dummy__ +var _ m_SimpleOrphanedImpl.Dummy__ +var _ m_SimpleOrphaned.Dummy__ +var _ m_OrphanedResource.Dummy__ diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/OrphanedResource/OrphanedResource.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/OrphanedResource/OrphanedResource.go new file mode 100644 index 0000000000..02507e8add --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/OrphanedResource/OrphanedResource.go @@ -0,0 +1,108 @@ +// Package OrphanedResource +// Dafny module OrphanedResource compiled into Go + +package OrphanedResource + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" + m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" + m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_SimpleOrphanedTypes.Dummy__ +var _ m_SimpleOrphanedImpl.Dummy__ +var _ m_SimpleOrphaned.Dummy__ + +type Dummy__ struct{} + +// Definition of class OrphanedResource +type OrphanedResource struct { + dummy byte +} + +func New_OrphanedResource_() *OrphanedResource { + _this := OrphanedResource{} + + return &_this +} + +type CompanionStruct_OrphanedResource_ struct { +} + +var Companion_OrphanedResource_ = CompanionStruct_OrphanedResource_{} + +func (_this *OrphanedResource) Equals(other *OrphanedResource) bool { + return _this == other +} + +func (_this *OrphanedResource) EqualsGeneric(x interface{}) bool { + other, ok := x.(*OrphanedResource) + return ok && _this.Equals(other) +} + +func (*OrphanedResource) String() string { + return "OrphanedResource.OrphanedResource" +} + +func Type_OrphanedResource_() _dafny.TypeDescriptor { + return type_OrphanedResource_{} +} + +type type_OrphanedResource_ struct { +} + +func (_this type_OrphanedResource_) Default() interface{} { + return (*OrphanedResource)(nil) +} + +func (_this type_OrphanedResource_) String() string { + return "OrphanedResource.OrphanedResource" +} +func (_this *OrphanedResource) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_SimpleOrphanedTypes.Companion_IOrphanedResource_.TraitID_} +} + +var _ m_SimpleOrphanedTypes.IOrphanedResource = &OrphanedResource{} +var _ _dafny.TraitOffspring = &OrphanedResource{} + +func (_this *OrphanedResource) OrphanedResourceOperation(input m_SimpleOrphanedTypes.OrphanedResourceOperationInput) m_Wrappers.Result { + var _out1 m_Wrappers.Result + _ = _out1 + _out1 = m_SimpleOrphanedTypes.Companion_IOrphanedResource_.OrphanedResourceOperation(_this, input) + return _out1 +} +func (_this *OrphanedResource) Ctor__() { + { + } +} +func (_this *OrphanedResource) OrphanedResourceOperation_k(input m_SimpleOrphanedTypes.OrphanedResourceOperationInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_SimpleOrphanedTypes.Companion_OrphanedResourceOperationOutput_.Default()) + _ = output + if (((input).Dtor_someString()).Is_Some()) && (_dafny.Companion_Sequence_.Equal(((input).Dtor_someString()).Dtor_value().(_dafny.Sequence), _dafny.SeqOfString("the extern MUST provide this string to the native resource's operation"))) { + output = m_Wrappers.Companion_Result_.Create_Success_(m_SimpleOrphanedTypes.Companion_OrphanedResourceOperationOutput_.Create_OrphanedResourceOperationOutput_(m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOfString("correct string")))) + return output + } else { + output = m_Wrappers.Companion_Result_.Create_Failure_(m_SimpleOrphanedTypes.Companion_Error_.Create_OrphanedError_(_dafny.SeqOfString("incorrect string"))) + return output + } + return output + } +} + +// End of class OrphanedResource diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphaned/SimpleOrphaned.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphaned/SimpleOrphaned.go new file mode 100644 index 0000000000..39ff28a59b --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphaned/SimpleOrphaned.go @@ -0,0 +1,152 @@ +// Package SimpleOrphaned +// Dafny module SimpleOrphaned compiled into Go + +package SimpleOrphaned + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" + m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_SimpleOrphanedTypes.Dummy__ +var _ m_SimpleOrphanedImpl.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "SimpleOrphaned.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) DefaultSimpleOrphanedConfig() m_SimpleOrphanedTypes.SimpleOrphanedConfig { + return m_SimpleOrphanedTypes.Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(m_Wrappers.Companion_Option_.Create_None_()) +} +func (_static *CompanionStruct_Default___) SimpleOrphaned(config m_SimpleOrphanedTypes.SimpleOrphanedConfig) m_Wrappers.Result { + var res m_Wrappers.Result = m_Wrappers.Result{} + _ = res + var _0_client *SimpleOrphanedClient + _ = _0_client + var _nw0 *SimpleOrphanedClient = New_SimpleOrphanedClient_() + _ = _nw0 + _nw0.Ctor__(m_SimpleOrphanedImpl.Companion_Config_.Create_Config_()) + _0_client = _nw0 + res = m_Wrappers.Companion_Result_.Create_Success_(_0_client) + return res + return res +} +func (_static *CompanionStruct_Default___) CreateSuccessOfClient(client m_SimpleOrphanedTypes.ISimpleOrphanedClient) m_Wrappers.Result { + return m_Wrappers.Companion_Result_.Create_Success_(client) +} +func (_static *CompanionStruct_Default___) CreateFailureOfError(error_ m_SimpleOrphanedTypes.Error) m_Wrappers.Result { + return m_Wrappers.Companion_Result_.Create_Failure_(error_) +} + +// End of class Default__ + +// Definition of class SimpleOrphanedClient +type SimpleOrphanedClient struct { + _config m_SimpleOrphanedImpl.Config +} + +func New_SimpleOrphanedClient_() *SimpleOrphanedClient { + _this := SimpleOrphanedClient{} + + _this._config = m_SimpleOrphanedImpl.Companion_Config_.Default() + return &_this +} + +type CompanionStruct_SimpleOrphanedClient_ struct { +} + +var Companion_SimpleOrphanedClient_ = CompanionStruct_SimpleOrphanedClient_{} + +func (_this *SimpleOrphanedClient) Equals(other *SimpleOrphanedClient) bool { + return _this == other +} + +func (_this *SimpleOrphanedClient) EqualsGeneric(x interface{}) bool { + other, ok := x.(*SimpleOrphanedClient) + return ok && _this.Equals(other) +} + +func (*SimpleOrphanedClient) String() string { + return "SimpleOrphaned.SimpleOrphanedClient" +} + +func Type_SimpleOrphanedClient_() _dafny.TypeDescriptor { + return type_SimpleOrphanedClient_{} +} + +type type_SimpleOrphanedClient_ struct { +} + +func (_this type_SimpleOrphanedClient_) Default() interface{} { + return (*SimpleOrphanedClient)(nil) +} + +func (_this type_SimpleOrphanedClient_) String() string { + return "SimpleOrphaned.SimpleOrphanedClient" +} +func (_this *SimpleOrphanedClient) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){m_SimpleOrphanedTypes.Companion_ISimpleOrphanedClient_.TraitID_} +} + +var _ m_SimpleOrphanedTypes.ISimpleOrphanedClient = &SimpleOrphanedClient{} +var _ _dafny.TraitOffspring = &SimpleOrphanedClient{} + +func (_this *SimpleOrphanedClient) Ctor__(config m_SimpleOrphanedImpl.Config) { + { + (_this)._config = config + } +} +func (_this *SimpleOrphanedClient) Config() m_SimpleOrphanedImpl.Config { + { + return _this._config + } +} + +// End of class SimpleOrphanedClient diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedImpl/SimpleOrphanedImpl.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedImpl/SimpleOrphanedImpl.go new file mode 100644 index 0000000000..db3f825674 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedImpl/SimpleOrphanedImpl.go @@ -0,0 +1,132 @@ +// Package SimpleOrphanedImpl +// Dafny module SimpleOrphanedImpl compiled into Go + +package SimpleOrphanedImpl + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_SimpleOrphanedTypes.Dummy__ + +type Dummy__ struct{} + +// Definition of datatype Config +type Config struct { + Data_Config_ +} + +func (_this Config) Get_() Data_Config_ { + return _this.Data_Config_ +} + +type Data_Config_ interface { + isConfig() +} + +type CompanionStruct_Config_ struct { +} + +var Companion_Config_ = CompanionStruct_Config_{} + +type Config_Config struct { +} + +func (Config_Config) isConfig() {} + +func (CompanionStruct_Config_) Create_Config_() Config { + return Config{Config_Config{}} +} + +func (_this Config) Is_Config() bool { + _, ok := _this.Get_().(Config_Config) + return ok +} + +func (CompanionStruct_Config_) Default() Config { + return Companion_Config_.Create_Config_() +} + +func (_ CompanionStruct_Config_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_Config_.Create_Config_(), true + default: + return Config{}, false + } + } +} + +func (_this Config) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case Config_Config: + { + return "SimpleOrphanedImpl.Config.Config" + } + default: + { + return "" + } + } +} + +func (_this Config) Equals(other Config) bool { + switch _this.Get_().(type) { + case Config_Config: + { + _, ok := other.Get_().(Config_Config) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this Config) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Config) + return ok && _this.Equals(typed) +} + +func Type_Config_() _dafny.TypeDescriptor { + return type_Config_{} +} + +type type_Config_ struct { +} + +func (_this type_Config_) Default() interface{} { + return Companion_Config_.Default() +} + +func (_this type_Config_) String() string { + return "SimpleOrphanedImpl.Config" +} +func (_this Config) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Config{} + +// End of datatype Config diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedTypes/SimpleOrphanedTypes.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedTypes/SimpleOrphanedTypes.go new file mode 100644 index 0000000000..1030b8c0e6 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedTypes/SimpleOrphanedTypes.go @@ -0,0 +1,2046 @@ +// Package SimpleOrphanedTypes +// Dafny module SimpleOrphanedTypes compiled into Go + +package SimpleOrphanedTypes + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "SimpleOrphanedTypes.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) IsDummySubsetType(x _dafny.Int) bool { + return (x).Sign() == 1 +} + +// End of class Default__ + +// Definition of datatype DafnyCallEvent +type DafnyCallEvent struct { + Data_DafnyCallEvent_ +} + +func (_this DafnyCallEvent) Get_() Data_DafnyCallEvent_ { + return _this.Data_DafnyCallEvent_ +} + +type Data_DafnyCallEvent_ interface { + isDafnyCallEvent() +} + +type CompanionStruct_DafnyCallEvent_ struct { +} + +var Companion_DafnyCallEvent_ = CompanionStruct_DafnyCallEvent_{} + +type DafnyCallEvent_DafnyCallEvent struct { + Input interface{} + Output interface{} +} + +func (DafnyCallEvent_DafnyCallEvent) isDafnyCallEvent() {} + +func (CompanionStruct_DafnyCallEvent_) Create_DafnyCallEvent_(Input interface{}, Output interface{}) DafnyCallEvent { + return DafnyCallEvent{DafnyCallEvent_DafnyCallEvent{Input, Output}} +} + +func (_this DafnyCallEvent) Is_DafnyCallEvent() bool { + _, ok := _this.Get_().(DafnyCallEvent_DafnyCallEvent) + return ok +} + +func (CompanionStruct_DafnyCallEvent_) Default(_default_I interface{}, _default_O interface{}) DafnyCallEvent { + return Companion_DafnyCallEvent_.Create_DafnyCallEvent_(_default_I, _default_O) +} + +func (_this DafnyCallEvent) Dtor_input() interface{} { + return _this.Get_().(DafnyCallEvent_DafnyCallEvent).Input +} + +func (_this DafnyCallEvent) Dtor_output() interface{} { + return _this.Get_().(DafnyCallEvent_DafnyCallEvent).Output +} + +func (_this DafnyCallEvent) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case DafnyCallEvent_DafnyCallEvent: + { + return "SimpleOrphanedTypes.DafnyCallEvent.DafnyCallEvent" + "(" + _dafny.String(data.Input) + ", " + _dafny.String(data.Output) + ")" + } + default: + { + return "" + } + } +} + +func (_this DafnyCallEvent) Equals(other DafnyCallEvent) bool { + switch data1 := _this.Get_().(type) { + case DafnyCallEvent_DafnyCallEvent: + { + data2, ok := other.Get_().(DafnyCallEvent_DafnyCallEvent) + return ok && _dafny.AreEqual(data1.Input, data2.Input) && _dafny.AreEqual(data1.Output, data2.Output) + } + default: + { + return false // unexpected + } + } +} + +func (_this DafnyCallEvent) EqualsGeneric(other interface{}) bool { + typed, ok := other.(DafnyCallEvent) + return ok && _this.Equals(typed) +} + +func Type_DafnyCallEvent_(Type_I_ _dafny.TypeDescriptor, Type_O_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { + return type_DafnyCallEvent_{Type_I_, Type_O_} +} + +type type_DafnyCallEvent_ struct { + Type_I_ _dafny.TypeDescriptor + Type_O_ _dafny.TypeDescriptor +} + +func (_this type_DafnyCallEvent_) Default() interface{} { + Type_I_ := _this.Type_I_ + _ = Type_I_ + Type_O_ := _this.Type_O_ + _ = Type_O_ + return Companion_DafnyCallEvent_.Default(Type_I_.Default(), Type_O_.Default()) +} + +func (_this type_DafnyCallEvent_) String() string { + return "SimpleOrphanedTypes.DafnyCallEvent" +} +func (_this DafnyCallEvent) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = DafnyCallEvent{} + +// End of datatype DafnyCallEvent + +// Definition of datatype CreateOrphanedErrorInput +type CreateOrphanedErrorInput struct { + Data_CreateOrphanedErrorInput_ +} + +func (_this CreateOrphanedErrorInput) Get_() Data_CreateOrphanedErrorInput_ { + return _this.Data_CreateOrphanedErrorInput_ +} + +type Data_CreateOrphanedErrorInput_ interface { + isCreateOrphanedErrorInput() +} + +type CompanionStruct_CreateOrphanedErrorInput_ struct { +} + +var Companion_CreateOrphanedErrorInput_ = CompanionStruct_CreateOrphanedErrorInput_{} + +type CreateOrphanedErrorInput_CreateOrphanedErrorInput struct { +} + +func (CreateOrphanedErrorInput_CreateOrphanedErrorInput) isCreateOrphanedErrorInput() {} + +func (CompanionStruct_CreateOrphanedErrorInput_) Create_CreateOrphanedErrorInput_() CreateOrphanedErrorInput { + return CreateOrphanedErrorInput{CreateOrphanedErrorInput_CreateOrphanedErrorInput{}} +} + +func (_this CreateOrphanedErrorInput) Is_CreateOrphanedErrorInput() bool { + _, ok := _this.Get_().(CreateOrphanedErrorInput_CreateOrphanedErrorInput) + return ok +} + +func (CompanionStruct_CreateOrphanedErrorInput_) Default() CreateOrphanedErrorInput { + return Companion_CreateOrphanedErrorInput_.Create_CreateOrphanedErrorInput_() +} + +func (_ CompanionStruct_CreateOrphanedErrorInput_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_CreateOrphanedErrorInput_.Create_CreateOrphanedErrorInput_(), true + default: + return CreateOrphanedErrorInput{}, false + } + } +} + +func (_this CreateOrphanedErrorInput) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case CreateOrphanedErrorInput_CreateOrphanedErrorInput: + { + return "SimpleOrphanedTypes.CreateOrphanedErrorInput.CreateOrphanedErrorInput" + } + default: + { + return "" + } + } +} + +func (_this CreateOrphanedErrorInput) Equals(other CreateOrphanedErrorInput) bool { + switch _this.Get_().(type) { + case CreateOrphanedErrorInput_CreateOrphanedErrorInput: + { + _, ok := other.Get_().(CreateOrphanedErrorInput_CreateOrphanedErrorInput) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateOrphanedErrorInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateOrphanedErrorInput) + return ok && _this.Equals(typed) +} + +func Type_CreateOrphanedErrorInput_() _dafny.TypeDescriptor { + return type_CreateOrphanedErrorInput_{} +} + +type type_CreateOrphanedErrorInput_ struct { +} + +func (_this type_CreateOrphanedErrorInput_) Default() interface{} { + return Companion_CreateOrphanedErrorInput_.Default() +} + +func (_this type_CreateOrphanedErrorInput_) String() string { + return "SimpleOrphanedTypes.CreateOrphanedErrorInput" +} +func (_this CreateOrphanedErrorInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateOrphanedErrorInput{} + +// End of datatype CreateOrphanedErrorInput + +// Definition of datatype CreateOrphanedErrorOutput +type CreateOrphanedErrorOutput struct { + Data_CreateOrphanedErrorOutput_ +} + +func (_this CreateOrphanedErrorOutput) Get_() Data_CreateOrphanedErrorOutput_ { + return _this.Data_CreateOrphanedErrorOutput_ +} + +type Data_CreateOrphanedErrorOutput_ interface { + isCreateOrphanedErrorOutput() +} + +type CompanionStruct_CreateOrphanedErrorOutput_ struct { +} + +var Companion_CreateOrphanedErrorOutput_ = CompanionStruct_CreateOrphanedErrorOutput_{} + +type CreateOrphanedErrorOutput_CreateOrphanedErrorOutput struct { +} + +func (CreateOrphanedErrorOutput_CreateOrphanedErrorOutput) isCreateOrphanedErrorOutput() {} + +func (CompanionStruct_CreateOrphanedErrorOutput_) Create_CreateOrphanedErrorOutput_() CreateOrphanedErrorOutput { + return CreateOrphanedErrorOutput{CreateOrphanedErrorOutput_CreateOrphanedErrorOutput{}} +} + +func (_this CreateOrphanedErrorOutput) Is_CreateOrphanedErrorOutput() bool { + _, ok := _this.Get_().(CreateOrphanedErrorOutput_CreateOrphanedErrorOutput) + return ok +} + +func (CompanionStruct_CreateOrphanedErrorOutput_) Default() CreateOrphanedErrorOutput { + return Companion_CreateOrphanedErrorOutput_.Create_CreateOrphanedErrorOutput_() +} + +func (_ CompanionStruct_CreateOrphanedErrorOutput_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_CreateOrphanedErrorOutput_.Create_CreateOrphanedErrorOutput_(), true + default: + return CreateOrphanedErrorOutput{}, false + } + } +} + +func (_this CreateOrphanedErrorOutput) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case CreateOrphanedErrorOutput_CreateOrphanedErrorOutput: + { + return "SimpleOrphanedTypes.CreateOrphanedErrorOutput.CreateOrphanedErrorOutput" + } + default: + { + return "" + } + } +} + +func (_this CreateOrphanedErrorOutput) Equals(other CreateOrphanedErrorOutput) bool { + switch _this.Get_().(type) { + case CreateOrphanedErrorOutput_CreateOrphanedErrorOutput: + { + _, ok := other.Get_().(CreateOrphanedErrorOutput_CreateOrphanedErrorOutput) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateOrphanedErrorOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateOrphanedErrorOutput) + return ok && _this.Equals(typed) +} + +func Type_CreateOrphanedErrorOutput_() _dafny.TypeDescriptor { + return type_CreateOrphanedErrorOutput_{} +} + +type type_CreateOrphanedErrorOutput_ struct { +} + +func (_this type_CreateOrphanedErrorOutput_) Default() interface{} { + return Companion_CreateOrphanedErrorOutput_.Default() +} + +func (_this type_CreateOrphanedErrorOutput_) String() string { + return "SimpleOrphanedTypes.CreateOrphanedErrorOutput" +} +func (_this CreateOrphanedErrorOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateOrphanedErrorOutput{} + +// End of datatype CreateOrphanedErrorOutput + +// Definition of datatype CreateOrphanedResourceInput +type CreateOrphanedResourceInput struct { + Data_CreateOrphanedResourceInput_ +} + +func (_this CreateOrphanedResourceInput) Get_() Data_CreateOrphanedResourceInput_ { + return _this.Data_CreateOrphanedResourceInput_ +} + +type Data_CreateOrphanedResourceInput_ interface { + isCreateOrphanedResourceInput() +} + +type CompanionStruct_CreateOrphanedResourceInput_ struct { +} + +var Companion_CreateOrphanedResourceInput_ = CompanionStruct_CreateOrphanedResourceInput_{} + +type CreateOrphanedResourceInput_CreateOrphanedResourceInput struct { +} + +func (CreateOrphanedResourceInput_CreateOrphanedResourceInput) isCreateOrphanedResourceInput() {} + +func (CompanionStruct_CreateOrphanedResourceInput_) Create_CreateOrphanedResourceInput_() CreateOrphanedResourceInput { + return CreateOrphanedResourceInput{CreateOrphanedResourceInput_CreateOrphanedResourceInput{}} +} + +func (_this CreateOrphanedResourceInput) Is_CreateOrphanedResourceInput() bool { + _, ok := _this.Get_().(CreateOrphanedResourceInput_CreateOrphanedResourceInput) + return ok +} + +func (CompanionStruct_CreateOrphanedResourceInput_) Default() CreateOrphanedResourceInput { + return Companion_CreateOrphanedResourceInput_.Create_CreateOrphanedResourceInput_() +} + +func (_ CompanionStruct_CreateOrphanedResourceInput_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_CreateOrphanedResourceInput_.Create_CreateOrphanedResourceInput_(), true + default: + return CreateOrphanedResourceInput{}, false + } + } +} + +func (_this CreateOrphanedResourceInput) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case CreateOrphanedResourceInput_CreateOrphanedResourceInput: + { + return "SimpleOrphanedTypes.CreateOrphanedResourceInput.CreateOrphanedResourceInput" + } + default: + { + return "" + } + } +} + +func (_this CreateOrphanedResourceInput) Equals(other CreateOrphanedResourceInput) bool { + switch _this.Get_().(type) { + case CreateOrphanedResourceInput_CreateOrphanedResourceInput: + { + _, ok := other.Get_().(CreateOrphanedResourceInput_CreateOrphanedResourceInput) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateOrphanedResourceInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateOrphanedResourceInput) + return ok && _this.Equals(typed) +} + +func Type_CreateOrphanedResourceInput_() _dafny.TypeDescriptor { + return type_CreateOrphanedResourceInput_{} +} + +type type_CreateOrphanedResourceInput_ struct { +} + +func (_this type_CreateOrphanedResourceInput_) Default() interface{} { + return Companion_CreateOrphanedResourceInput_.Default() +} + +func (_this type_CreateOrphanedResourceInput_) String() string { + return "SimpleOrphanedTypes.CreateOrphanedResourceInput" +} +func (_this CreateOrphanedResourceInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateOrphanedResourceInput{} + +// End of datatype CreateOrphanedResourceInput + +// Definition of datatype CreateOrphanedResourceOutput +type CreateOrphanedResourceOutput struct { + Data_CreateOrphanedResourceOutput_ +} + +func (_this CreateOrphanedResourceOutput) Get_() Data_CreateOrphanedResourceOutput_ { + return _this.Data_CreateOrphanedResourceOutput_ +} + +type Data_CreateOrphanedResourceOutput_ interface { + isCreateOrphanedResourceOutput() +} + +type CompanionStruct_CreateOrphanedResourceOutput_ struct { +} + +var Companion_CreateOrphanedResourceOutput_ = CompanionStruct_CreateOrphanedResourceOutput_{} + +type CreateOrphanedResourceOutput_CreateOrphanedResourceOutput struct { +} + +func (CreateOrphanedResourceOutput_CreateOrphanedResourceOutput) isCreateOrphanedResourceOutput() {} + +func (CompanionStruct_CreateOrphanedResourceOutput_) Create_CreateOrphanedResourceOutput_() CreateOrphanedResourceOutput { + return CreateOrphanedResourceOutput{CreateOrphanedResourceOutput_CreateOrphanedResourceOutput{}} +} + +func (_this CreateOrphanedResourceOutput) Is_CreateOrphanedResourceOutput() bool { + _, ok := _this.Get_().(CreateOrphanedResourceOutput_CreateOrphanedResourceOutput) + return ok +} + +func (CompanionStruct_CreateOrphanedResourceOutput_) Default() CreateOrphanedResourceOutput { + return Companion_CreateOrphanedResourceOutput_.Create_CreateOrphanedResourceOutput_() +} + +func (_ CompanionStruct_CreateOrphanedResourceOutput_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_CreateOrphanedResourceOutput_.Create_CreateOrphanedResourceOutput_(), true + default: + return CreateOrphanedResourceOutput{}, false + } + } +} + +func (_this CreateOrphanedResourceOutput) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case CreateOrphanedResourceOutput_CreateOrphanedResourceOutput: + { + return "SimpleOrphanedTypes.CreateOrphanedResourceOutput.CreateOrphanedResourceOutput" + } + default: + { + return "" + } + } +} + +func (_this CreateOrphanedResourceOutput) Equals(other CreateOrphanedResourceOutput) bool { + switch _this.Get_().(type) { + case CreateOrphanedResourceOutput_CreateOrphanedResourceOutput: + { + _, ok := other.Get_().(CreateOrphanedResourceOutput_CreateOrphanedResourceOutput) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateOrphanedResourceOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateOrphanedResourceOutput) + return ok && _this.Equals(typed) +} + +func Type_CreateOrphanedResourceOutput_() _dafny.TypeDescriptor { + return type_CreateOrphanedResourceOutput_{} +} + +type type_CreateOrphanedResourceOutput_ struct { +} + +func (_this type_CreateOrphanedResourceOutput_) Default() interface{} { + return Companion_CreateOrphanedResourceOutput_.Default() +} + +func (_this type_CreateOrphanedResourceOutput_) String() string { + return "SimpleOrphanedTypes.CreateOrphanedResourceOutput" +} +func (_this CreateOrphanedResourceOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateOrphanedResourceOutput{} + +// End of datatype CreateOrphanedResourceOutput + +// Definition of datatype CreateOrphanedStructureInput +type CreateOrphanedStructureInput struct { + Data_CreateOrphanedStructureInput_ +} + +func (_this CreateOrphanedStructureInput) Get_() Data_CreateOrphanedStructureInput_ { + return _this.Data_CreateOrphanedStructureInput_ +} + +type Data_CreateOrphanedStructureInput_ interface { + isCreateOrphanedStructureInput() +} + +type CompanionStruct_CreateOrphanedStructureInput_ struct { +} + +var Companion_CreateOrphanedStructureInput_ = CompanionStruct_CreateOrphanedStructureInput_{} + +type CreateOrphanedStructureInput_CreateOrphanedStructureInput struct { +} + +func (CreateOrphanedStructureInput_CreateOrphanedStructureInput) isCreateOrphanedStructureInput() {} + +func (CompanionStruct_CreateOrphanedStructureInput_) Create_CreateOrphanedStructureInput_() CreateOrphanedStructureInput { + return CreateOrphanedStructureInput{CreateOrphanedStructureInput_CreateOrphanedStructureInput{}} +} + +func (_this CreateOrphanedStructureInput) Is_CreateOrphanedStructureInput() bool { + _, ok := _this.Get_().(CreateOrphanedStructureInput_CreateOrphanedStructureInput) + return ok +} + +func (CompanionStruct_CreateOrphanedStructureInput_) Default() CreateOrphanedStructureInput { + return Companion_CreateOrphanedStructureInput_.Create_CreateOrphanedStructureInput_() +} + +func (_ CompanionStruct_CreateOrphanedStructureInput_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_CreateOrphanedStructureInput_.Create_CreateOrphanedStructureInput_(), true + default: + return CreateOrphanedStructureInput{}, false + } + } +} + +func (_this CreateOrphanedStructureInput) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case CreateOrphanedStructureInput_CreateOrphanedStructureInput: + { + return "SimpleOrphanedTypes.CreateOrphanedStructureInput.CreateOrphanedStructureInput" + } + default: + { + return "" + } + } +} + +func (_this CreateOrphanedStructureInput) Equals(other CreateOrphanedStructureInput) bool { + switch _this.Get_().(type) { + case CreateOrphanedStructureInput_CreateOrphanedStructureInput: + { + _, ok := other.Get_().(CreateOrphanedStructureInput_CreateOrphanedStructureInput) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateOrphanedStructureInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateOrphanedStructureInput) + return ok && _this.Equals(typed) +} + +func Type_CreateOrphanedStructureInput_() _dafny.TypeDescriptor { + return type_CreateOrphanedStructureInput_{} +} + +type type_CreateOrphanedStructureInput_ struct { +} + +func (_this type_CreateOrphanedStructureInput_) Default() interface{} { + return Companion_CreateOrphanedStructureInput_.Default() +} + +func (_this type_CreateOrphanedStructureInput_) String() string { + return "SimpleOrphanedTypes.CreateOrphanedStructureInput" +} +func (_this CreateOrphanedStructureInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateOrphanedStructureInput{} + +// End of datatype CreateOrphanedStructureInput + +// Definition of datatype CreateOrphanedStructureOutput +type CreateOrphanedStructureOutput struct { + Data_CreateOrphanedStructureOutput_ +} + +func (_this CreateOrphanedStructureOutput) Get_() Data_CreateOrphanedStructureOutput_ { + return _this.Data_CreateOrphanedStructureOutput_ +} + +type Data_CreateOrphanedStructureOutput_ interface { + isCreateOrphanedStructureOutput() +} + +type CompanionStruct_CreateOrphanedStructureOutput_ struct { +} + +var Companion_CreateOrphanedStructureOutput_ = CompanionStruct_CreateOrphanedStructureOutput_{} + +type CreateOrphanedStructureOutput_CreateOrphanedStructureOutput struct { +} + +func (CreateOrphanedStructureOutput_CreateOrphanedStructureOutput) isCreateOrphanedStructureOutput() { +} + +func (CompanionStruct_CreateOrphanedStructureOutput_) Create_CreateOrphanedStructureOutput_() CreateOrphanedStructureOutput { + return CreateOrphanedStructureOutput{CreateOrphanedStructureOutput_CreateOrphanedStructureOutput{}} +} + +func (_this CreateOrphanedStructureOutput) Is_CreateOrphanedStructureOutput() bool { + _, ok := _this.Get_().(CreateOrphanedStructureOutput_CreateOrphanedStructureOutput) + return ok +} + +func (CompanionStruct_CreateOrphanedStructureOutput_) Default() CreateOrphanedStructureOutput { + return Companion_CreateOrphanedStructureOutput_.Create_CreateOrphanedStructureOutput_() +} + +func (_ CompanionStruct_CreateOrphanedStructureOutput_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_CreateOrphanedStructureOutput_.Create_CreateOrphanedStructureOutput_(), true + default: + return CreateOrphanedStructureOutput{}, false + } + } +} + +func (_this CreateOrphanedStructureOutput) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case CreateOrphanedStructureOutput_CreateOrphanedStructureOutput: + { + return "SimpleOrphanedTypes.CreateOrphanedStructureOutput.CreateOrphanedStructureOutput" + } + default: + { + return "" + } + } +} + +func (_this CreateOrphanedStructureOutput) Equals(other CreateOrphanedStructureOutput) bool { + switch _this.Get_().(type) { + case CreateOrphanedStructureOutput_CreateOrphanedStructureOutput: + { + _, ok := other.Get_().(CreateOrphanedStructureOutput_CreateOrphanedStructureOutput) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this CreateOrphanedStructureOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(CreateOrphanedStructureOutput) + return ok && _this.Equals(typed) +} + +func Type_CreateOrphanedStructureOutput_() _dafny.TypeDescriptor { + return type_CreateOrphanedStructureOutput_{} +} + +type type_CreateOrphanedStructureOutput_ struct { +} + +func (_this type_CreateOrphanedStructureOutput_) Default() interface{} { + return Companion_CreateOrphanedStructureOutput_.Default() +} + +func (_this type_CreateOrphanedStructureOutput_) String() string { + return "SimpleOrphanedTypes.CreateOrphanedStructureOutput" +} +func (_this CreateOrphanedStructureOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = CreateOrphanedStructureOutput{} + +// End of datatype CreateOrphanedStructureOutput + +// Definition of datatype OrphanedConfigShape +type OrphanedConfigShape struct { + Data_OrphanedConfigShape_ +} + +func (_this OrphanedConfigShape) Get_() Data_OrphanedConfigShape_ { + return _this.Data_OrphanedConfigShape_ +} + +type Data_OrphanedConfigShape_ interface { + isOrphanedConfigShape() +} + +type CompanionStruct_OrphanedConfigShape_ struct { +} + +var Companion_OrphanedConfigShape_ = CompanionStruct_OrphanedConfigShape_{} + +type OrphanedConfigShape_OrphanedConfigShape struct { + StringMember m_Wrappers.Option +} + +func (OrphanedConfigShape_OrphanedConfigShape) isOrphanedConfigShape() {} + +func (CompanionStruct_OrphanedConfigShape_) Create_OrphanedConfigShape_(StringMember m_Wrappers.Option) OrphanedConfigShape { + return OrphanedConfigShape{OrphanedConfigShape_OrphanedConfigShape{StringMember}} +} + +func (_this OrphanedConfigShape) Is_OrphanedConfigShape() bool { + _, ok := _this.Get_().(OrphanedConfigShape_OrphanedConfigShape) + return ok +} + +func (CompanionStruct_OrphanedConfigShape_) Default() OrphanedConfigShape { + return Companion_OrphanedConfigShape_.Create_OrphanedConfigShape_(m_Wrappers.Companion_Option_.Default()) +} + +func (_this OrphanedConfigShape) Dtor_stringMember() m_Wrappers.Option { + return _this.Get_().(OrphanedConfigShape_OrphanedConfigShape).StringMember +} + +func (_this OrphanedConfigShape) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case OrphanedConfigShape_OrphanedConfigShape: + { + return "SimpleOrphanedTypes.OrphanedConfigShape.OrphanedConfigShape" + "(" + _dafny.String(data.StringMember) + ")" + } + default: + { + return "" + } + } +} + +func (_this OrphanedConfigShape) Equals(other OrphanedConfigShape) bool { + switch data1 := _this.Get_().(type) { + case OrphanedConfigShape_OrphanedConfigShape: + { + data2, ok := other.Get_().(OrphanedConfigShape_OrphanedConfigShape) + return ok && data1.StringMember.Equals(data2.StringMember) + } + default: + { + return false // unexpected + } + } +} + +func (_this OrphanedConfigShape) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OrphanedConfigShape) + return ok && _this.Equals(typed) +} + +func Type_OrphanedConfigShape_() _dafny.TypeDescriptor { + return type_OrphanedConfigShape_{} +} + +type type_OrphanedConfigShape_ struct { +} + +func (_this type_OrphanedConfigShape_) Default() interface{} { + return Companion_OrphanedConfigShape_.Default() +} + +func (_this type_OrphanedConfigShape_) String() string { + return "SimpleOrphanedTypes.OrphanedConfigShape" +} +func (_this OrphanedConfigShape) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OrphanedConfigShape{} + +// End of datatype OrphanedConfigShape + +// Definition of datatype OrphanedResourceOperationInput +type OrphanedResourceOperationInput struct { + Data_OrphanedResourceOperationInput_ +} + +func (_this OrphanedResourceOperationInput) Get_() Data_OrphanedResourceOperationInput_ { + return _this.Data_OrphanedResourceOperationInput_ +} + +type Data_OrphanedResourceOperationInput_ interface { + isOrphanedResourceOperationInput() +} + +type CompanionStruct_OrphanedResourceOperationInput_ struct { +} + +var Companion_OrphanedResourceOperationInput_ = CompanionStruct_OrphanedResourceOperationInput_{} + +type OrphanedResourceOperationInput_OrphanedResourceOperationInput struct { + SomeString m_Wrappers.Option +} + +func (OrphanedResourceOperationInput_OrphanedResourceOperationInput) isOrphanedResourceOperationInput() { +} + +func (CompanionStruct_OrphanedResourceOperationInput_) Create_OrphanedResourceOperationInput_(SomeString m_Wrappers.Option) OrphanedResourceOperationInput { + return OrphanedResourceOperationInput{OrphanedResourceOperationInput_OrphanedResourceOperationInput{SomeString}} +} + +func (_this OrphanedResourceOperationInput) Is_OrphanedResourceOperationInput() bool { + _, ok := _this.Get_().(OrphanedResourceOperationInput_OrphanedResourceOperationInput) + return ok +} + +func (CompanionStruct_OrphanedResourceOperationInput_) Default() OrphanedResourceOperationInput { + return Companion_OrphanedResourceOperationInput_.Create_OrphanedResourceOperationInput_(m_Wrappers.Companion_Option_.Default()) +} + +func (_this OrphanedResourceOperationInput) Dtor_someString() m_Wrappers.Option { + return _this.Get_().(OrphanedResourceOperationInput_OrphanedResourceOperationInput).SomeString +} + +func (_this OrphanedResourceOperationInput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case OrphanedResourceOperationInput_OrphanedResourceOperationInput: + { + return "SimpleOrphanedTypes.OrphanedResourceOperationInput.OrphanedResourceOperationInput" + "(" + _dafny.String(data.SomeString) + ")" + } + default: + { + return "" + } + } +} + +func (_this OrphanedResourceOperationInput) Equals(other OrphanedResourceOperationInput) bool { + switch data1 := _this.Get_().(type) { + case OrphanedResourceOperationInput_OrphanedResourceOperationInput: + { + data2, ok := other.Get_().(OrphanedResourceOperationInput_OrphanedResourceOperationInput) + return ok && data1.SomeString.Equals(data2.SomeString) + } + default: + { + return false // unexpected + } + } +} + +func (_this OrphanedResourceOperationInput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OrphanedResourceOperationInput) + return ok && _this.Equals(typed) +} + +func Type_OrphanedResourceOperationInput_() _dafny.TypeDescriptor { + return type_OrphanedResourceOperationInput_{} +} + +type type_OrphanedResourceOperationInput_ struct { +} + +func (_this type_OrphanedResourceOperationInput_) Default() interface{} { + return Companion_OrphanedResourceOperationInput_.Default() +} + +func (_this type_OrphanedResourceOperationInput_) String() string { + return "SimpleOrphanedTypes.OrphanedResourceOperationInput" +} +func (_this OrphanedResourceOperationInput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OrphanedResourceOperationInput{} + +// End of datatype OrphanedResourceOperationInput + +// Definition of datatype OrphanedResourceOperationOutput +type OrphanedResourceOperationOutput struct { + Data_OrphanedResourceOperationOutput_ +} + +func (_this OrphanedResourceOperationOutput) Get_() Data_OrphanedResourceOperationOutput_ { + return _this.Data_OrphanedResourceOperationOutput_ +} + +type Data_OrphanedResourceOperationOutput_ interface { + isOrphanedResourceOperationOutput() +} + +type CompanionStruct_OrphanedResourceOperationOutput_ struct { +} + +var Companion_OrphanedResourceOperationOutput_ = CompanionStruct_OrphanedResourceOperationOutput_{} + +type OrphanedResourceOperationOutput_OrphanedResourceOperationOutput struct { + SomeString m_Wrappers.Option +} + +func (OrphanedResourceOperationOutput_OrphanedResourceOperationOutput) isOrphanedResourceOperationOutput() { +} + +func (CompanionStruct_OrphanedResourceOperationOutput_) Create_OrphanedResourceOperationOutput_(SomeString m_Wrappers.Option) OrphanedResourceOperationOutput { + return OrphanedResourceOperationOutput{OrphanedResourceOperationOutput_OrphanedResourceOperationOutput{SomeString}} +} + +func (_this OrphanedResourceOperationOutput) Is_OrphanedResourceOperationOutput() bool { + _, ok := _this.Get_().(OrphanedResourceOperationOutput_OrphanedResourceOperationOutput) + return ok +} + +func (CompanionStruct_OrphanedResourceOperationOutput_) Default() OrphanedResourceOperationOutput { + return Companion_OrphanedResourceOperationOutput_.Create_OrphanedResourceOperationOutput_(m_Wrappers.Companion_Option_.Default()) +} + +func (_this OrphanedResourceOperationOutput) Dtor_someString() m_Wrappers.Option { + return _this.Get_().(OrphanedResourceOperationOutput_OrphanedResourceOperationOutput).SomeString +} + +func (_this OrphanedResourceOperationOutput) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case OrphanedResourceOperationOutput_OrphanedResourceOperationOutput: + { + return "SimpleOrphanedTypes.OrphanedResourceOperationOutput.OrphanedResourceOperationOutput" + "(" + _dafny.String(data.SomeString) + ")" + } + default: + { + return "" + } + } +} + +func (_this OrphanedResourceOperationOutput) Equals(other OrphanedResourceOperationOutput) bool { + switch data1 := _this.Get_().(type) { + case OrphanedResourceOperationOutput_OrphanedResourceOperationOutput: + { + data2, ok := other.Get_().(OrphanedResourceOperationOutput_OrphanedResourceOperationOutput) + return ok && data1.SomeString.Equals(data2.SomeString) + } + default: + { + return false // unexpected + } + } +} + +func (_this OrphanedResourceOperationOutput) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OrphanedResourceOperationOutput) + return ok && _this.Equals(typed) +} + +func Type_OrphanedResourceOperationOutput_() _dafny.TypeDescriptor { + return type_OrphanedResourceOperationOutput_{} +} + +type type_OrphanedResourceOperationOutput_ struct { +} + +func (_this type_OrphanedResourceOperationOutput_) Default() interface{} { + return Companion_OrphanedResourceOperationOutput_.Default() +} + +func (_this type_OrphanedResourceOperationOutput_) String() string { + return "SimpleOrphanedTypes.OrphanedResourceOperationOutput" +} +func (_this OrphanedResourceOperationOutput) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OrphanedResourceOperationOutput{} + +// End of datatype OrphanedResourceOperationOutput + +// Definition of class IOrphanedResourceCallHistory +type IOrphanedResourceCallHistory struct { + dummy byte +} + +func New_IOrphanedResourceCallHistory_() *IOrphanedResourceCallHistory { + _this := IOrphanedResourceCallHistory{} + + return &_this +} + +type CompanionStruct_IOrphanedResourceCallHistory_ struct { +} + +var Companion_IOrphanedResourceCallHistory_ = CompanionStruct_IOrphanedResourceCallHistory_{} + +func (_this *IOrphanedResourceCallHistory) Equals(other *IOrphanedResourceCallHistory) bool { + return _this == other +} + +func (_this *IOrphanedResourceCallHistory) EqualsGeneric(x interface{}) bool { + other, ok := x.(*IOrphanedResourceCallHistory) + return ok && _this.Equals(other) +} + +func (*IOrphanedResourceCallHistory) String() string { + return "SimpleOrphanedTypes.IOrphanedResourceCallHistory" +} + +func Type_IOrphanedResourceCallHistory_() _dafny.TypeDescriptor { + return type_IOrphanedResourceCallHistory_{} +} + +type type_IOrphanedResourceCallHistory_ struct { +} + +func (_this type_IOrphanedResourceCallHistory_) Default() interface{} { + return (*IOrphanedResourceCallHistory)(nil) +} + +func (_this type_IOrphanedResourceCallHistory_) String() string { + return "SimpleOrphanedTypes.IOrphanedResourceCallHistory" +} +func (_this *IOrphanedResourceCallHistory) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &IOrphanedResourceCallHistory{} + +// End of class IOrphanedResourceCallHistory + +// Definition of trait IOrphanedResource +type IOrphanedResource interface { + String() string + OrphanedResourceOperation(input OrphanedResourceOperationInput) m_Wrappers.Result + OrphanedResourceOperation_k(input OrphanedResourceOperationInput) m_Wrappers.Result +} + +func (_static *CompanionStruct_IOrphanedResource_) OrphanedResourceOperation(_this IOrphanedResource, input OrphanedResourceOperationInput) m_Wrappers.Result { + { + var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_OrphanedResourceOperationOutput_.Default()) + _ = output + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = (_this).OrphanedResourceOperation_k(input) + output = _out0 + return output + } +} + +type CompanionStruct_IOrphanedResource_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_IOrphanedResource_ = CompanionStruct_IOrphanedResource_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_IOrphanedResource_) CastTo_(x interface{}) IOrphanedResource { + var t IOrphanedResource + t, _ = x.(IOrphanedResource) + return t +} + +// End of trait IOrphanedResource + +// Definition of datatype OrphanedStructure +type OrphanedStructure struct { + Data_OrphanedStructure_ +} + +func (_this OrphanedStructure) Get_() Data_OrphanedStructure_ { + return _this.Data_OrphanedStructure_ +} + +type Data_OrphanedStructure_ interface { + isOrphanedStructure() +} + +type CompanionStruct_OrphanedStructure_ struct { +} + +var Companion_OrphanedStructure_ = CompanionStruct_OrphanedStructure_{} + +type OrphanedStructure_OrphanedStructure struct { + BlobValue m_Wrappers.Option + BooleanValue m_Wrappers.Option + StringValue m_Wrappers.Option + IntegerValue m_Wrappers.Option + LongValue m_Wrappers.Option + UnionValue m_Wrappers.Option + EnumValue m_Wrappers.Option + MapValue m_Wrappers.Option + ListValue m_Wrappers.Option +} + +func (OrphanedStructure_OrphanedStructure) isOrphanedStructure() {} + +func (CompanionStruct_OrphanedStructure_) Create_OrphanedStructure_(BlobValue m_Wrappers.Option, BooleanValue m_Wrappers.Option, StringValue m_Wrappers.Option, IntegerValue m_Wrappers.Option, LongValue m_Wrappers.Option, UnionValue m_Wrappers.Option, EnumValue m_Wrappers.Option, MapValue m_Wrappers.Option, ListValue m_Wrappers.Option) OrphanedStructure { + return OrphanedStructure{OrphanedStructure_OrphanedStructure{BlobValue, BooleanValue, StringValue, IntegerValue, LongValue, UnionValue, EnumValue, MapValue, ListValue}} +} + +func (_this OrphanedStructure) Is_OrphanedStructure() bool { + _, ok := _this.Get_().(OrphanedStructure_OrphanedStructure) + return ok +} + +func (CompanionStruct_OrphanedStructure_) Default() OrphanedStructure { + return Companion_OrphanedStructure_.Create_OrphanedStructure_(m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) +} + +func (_this OrphanedStructure) Dtor_blobValue() m_Wrappers.Option { + return _this.Get_().(OrphanedStructure_OrphanedStructure).BlobValue +} + +func (_this OrphanedStructure) Dtor_booleanValue() m_Wrappers.Option { + return _this.Get_().(OrphanedStructure_OrphanedStructure).BooleanValue +} + +func (_this OrphanedStructure) Dtor_stringValue() m_Wrappers.Option { + return _this.Get_().(OrphanedStructure_OrphanedStructure).StringValue +} + +func (_this OrphanedStructure) Dtor_integerValue() m_Wrappers.Option { + return _this.Get_().(OrphanedStructure_OrphanedStructure).IntegerValue +} + +func (_this OrphanedStructure) Dtor_longValue() m_Wrappers.Option { + return _this.Get_().(OrphanedStructure_OrphanedStructure).LongValue +} + +func (_this OrphanedStructure) Dtor_unionValue() m_Wrappers.Option { + return _this.Get_().(OrphanedStructure_OrphanedStructure).UnionValue +} + +func (_this OrphanedStructure) Dtor_enumValue() m_Wrappers.Option { + return _this.Get_().(OrphanedStructure_OrphanedStructure).EnumValue +} + +func (_this OrphanedStructure) Dtor_mapValue() m_Wrappers.Option { + return _this.Get_().(OrphanedStructure_OrphanedStructure).MapValue +} + +func (_this OrphanedStructure) Dtor_listValue() m_Wrappers.Option { + return _this.Get_().(OrphanedStructure_OrphanedStructure).ListValue +} + +func (_this OrphanedStructure) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case OrphanedStructure_OrphanedStructure: + { + return "SimpleOrphanedTypes.OrphanedStructure.OrphanedStructure" + "(" + _dafny.String(data.BlobValue) + ", " + _dafny.String(data.BooleanValue) + ", " + _dafny.String(data.StringValue) + ", " + _dafny.String(data.IntegerValue) + ", " + _dafny.String(data.LongValue) + ", " + _dafny.String(data.UnionValue) + ", " + _dafny.String(data.EnumValue) + ", " + _dafny.String(data.MapValue) + ", " + _dafny.String(data.ListValue) + ")" + } + default: + { + return "" + } + } +} + +func (_this OrphanedStructure) Equals(other OrphanedStructure) bool { + switch data1 := _this.Get_().(type) { + case OrphanedStructure_OrphanedStructure: + { + data2, ok := other.Get_().(OrphanedStructure_OrphanedStructure) + return ok && data1.BlobValue.Equals(data2.BlobValue) && data1.BooleanValue.Equals(data2.BooleanValue) && data1.StringValue.Equals(data2.StringValue) && data1.IntegerValue.Equals(data2.IntegerValue) && data1.LongValue.Equals(data2.LongValue) && data1.UnionValue.Equals(data2.UnionValue) && data1.EnumValue.Equals(data2.EnumValue) && data1.MapValue.Equals(data2.MapValue) && data1.ListValue.Equals(data2.ListValue) + } + default: + { + return false // unexpected + } + } +} + +func (_this OrphanedStructure) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OrphanedStructure) + return ok && _this.Equals(typed) +} + +func Type_OrphanedStructure_() _dafny.TypeDescriptor { + return type_OrphanedStructure_{} +} + +type type_OrphanedStructure_ struct { +} + +func (_this type_OrphanedStructure_) Default() interface{} { + return Companion_OrphanedStructure_.Default() +} + +func (_this type_OrphanedStructure_) String() string { + return "SimpleOrphanedTypes.OrphanedStructure" +} +func (_this OrphanedStructure) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OrphanedStructure{} + +// End of datatype OrphanedStructure + +// Definition of datatype OrphanedUnion +type OrphanedUnion struct { + Data_OrphanedUnion_ +} + +func (_this OrphanedUnion) Get_() Data_OrphanedUnion_ { + return _this.Data_OrphanedUnion_ +} + +type Data_OrphanedUnion_ interface { + isOrphanedUnion() +} + +type CompanionStruct_OrphanedUnion_ struct { +} + +var Companion_OrphanedUnion_ = CompanionStruct_OrphanedUnion_{} + +type OrphanedUnion_integerValue struct { + IntegerValue int32 +} + +func (OrphanedUnion_integerValue) isOrphanedUnion() {} + +func (CompanionStruct_OrphanedUnion_) Create_integerValue_(IntegerValue int32) OrphanedUnion { + return OrphanedUnion{OrphanedUnion_integerValue{IntegerValue}} +} + +func (_this OrphanedUnion) Is_integerValue() bool { + _, ok := _this.Get_().(OrphanedUnion_integerValue) + return ok +} + +type OrphanedUnion_stringValue struct { + StringValue _dafny.Sequence +} + +func (OrphanedUnion_stringValue) isOrphanedUnion() {} + +func (CompanionStruct_OrphanedUnion_) Create_stringValue_(StringValue _dafny.Sequence) OrphanedUnion { + return OrphanedUnion{OrphanedUnion_stringValue{StringValue}} +} + +func (_this OrphanedUnion) Is_stringValue() bool { + _, ok := _this.Get_().(OrphanedUnion_stringValue) + return ok +} + +func (CompanionStruct_OrphanedUnion_) Default() OrphanedUnion { + return Companion_OrphanedUnion_.Create_integerValue_(int32(0)) +} + +func (_this OrphanedUnion) Dtor_integerValue() int32 { + return _this.Get_().(OrphanedUnion_integerValue).IntegerValue +} + +func (_this OrphanedUnion) Dtor_stringValue() _dafny.Sequence { + return _this.Get_().(OrphanedUnion_stringValue).StringValue +} + +func (_this OrphanedUnion) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case OrphanedUnion_integerValue: + { + return "SimpleOrphanedTypes.OrphanedUnion.integerValue" + "(" + _dafny.String(data.IntegerValue) + ")" + } + case OrphanedUnion_stringValue: + { + return "SimpleOrphanedTypes.OrphanedUnion.stringValue" + "(" + _dafny.String(data.StringValue) + ")" + } + default: + { + return "" + } + } +} + +func (_this OrphanedUnion) Equals(other OrphanedUnion) bool { + switch data1 := _this.Get_().(type) { + case OrphanedUnion_integerValue: + { + data2, ok := other.Get_().(OrphanedUnion_integerValue) + return ok && data1.IntegerValue == data2.IntegerValue + } + case OrphanedUnion_stringValue: + { + data2, ok := other.Get_().(OrphanedUnion_stringValue) + return ok && data1.StringValue.Equals(data2.StringValue) + } + default: + { + return false // unexpected + } + } +} + +func (_this OrphanedUnion) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OrphanedUnion) + return ok && _this.Equals(typed) +} + +func Type_OrphanedUnion_() _dafny.TypeDescriptor { + return type_OrphanedUnion_{} +} + +type type_OrphanedUnion_ struct { +} + +func (_this type_OrphanedUnion_) Default() interface{} { + return Companion_OrphanedUnion_.Default() +} + +func (_this type_OrphanedUnion_) String() string { + return "SimpleOrphanedTypes.OrphanedUnion" +} +func (_this OrphanedUnion) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OrphanedUnion{} + +// End of datatype OrphanedUnion + +// Definition of datatype OrphanedV1Enum +type OrphanedV1Enum struct { + Data_OrphanedV1Enum_ +} + +func (_this OrphanedV1Enum) Get_() Data_OrphanedV1Enum_ { + return _this.Data_OrphanedV1Enum_ +} + +type Data_OrphanedV1Enum_ interface { + isOrphanedV1Enum() +} + +type CompanionStruct_OrphanedV1Enum_ struct { +} + +var Companion_OrphanedV1Enum_ = CompanionStruct_OrphanedV1Enum_{} + +type OrphanedV1Enum_FIRST struct { +} + +func (OrphanedV1Enum_FIRST) isOrphanedV1Enum() {} + +func (CompanionStruct_OrphanedV1Enum_) Create_FIRST_() OrphanedV1Enum { + return OrphanedV1Enum{OrphanedV1Enum_FIRST{}} +} + +func (_this OrphanedV1Enum) Is_FIRST() bool { + _, ok := _this.Get_().(OrphanedV1Enum_FIRST) + return ok +} + +type OrphanedV1Enum_SECOND struct { +} + +func (OrphanedV1Enum_SECOND) isOrphanedV1Enum() {} + +func (CompanionStruct_OrphanedV1Enum_) Create_SECOND_() OrphanedV1Enum { + return OrphanedV1Enum{OrphanedV1Enum_SECOND{}} +} + +func (_this OrphanedV1Enum) Is_SECOND() bool { + _, ok := _this.Get_().(OrphanedV1Enum_SECOND) + return ok +} + +type OrphanedV1Enum_THIRD struct { +} + +func (OrphanedV1Enum_THIRD) isOrphanedV1Enum() {} + +func (CompanionStruct_OrphanedV1Enum_) Create_THIRD_() OrphanedV1Enum { + return OrphanedV1Enum{OrphanedV1Enum_THIRD{}} +} + +func (_this OrphanedV1Enum) Is_THIRD() bool { + _, ok := _this.Get_().(OrphanedV1Enum_THIRD) + return ok +} + +func (CompanionStruct_OrphanedV1Enum_) Default() OrphanedV1Enum { + return Companion_OrphanedV1Enum_.Create_FIRST_() +} + +func (_ CompanionStruct_OrphanedV1Enum_) AllSingletonConstructors() _dafny.Iterator { + i := -1 + return func() (interface{}, bool) { + i++ + switch i { + case 0: + return Companion_OrphanedV1Enum_.Create_FIRST_(), true + case 1: + return Companion_OrphanedV1Enum_.Create_SECOND_(), true + case 2: + return Companion_OrphanedV1Enum_.Create_THIRD_(), true + default: + return OrphanedV1Enum{}, false + } + } +} + +func (_this OrphanedV1Enum) String() string { + switch _this.Get_().(type) { + case nil: + return "null" + case OrphanedV1Enum_FIRST: + { + return "SimpleOrphanedTypes.OrphanedV1Enum.FIRST" + } + case OrphanedV1Enum_SECOND: + { + return "SimpleOrphanedTypes.OrphanedV1Enum.SECOND" + } + case OrphanedV1Enum_THIRD: + { + return "SimpleOrphanedTypes.OrphanedV1Enum.THIRD" + } + default: + { + return "" + } + } +} + +func (_this OrphanedV1Enum) Equals(other OrphanedV1Enum) bool { + switch _this.Get_().(type) { + case OrphanedV1Enum_FIRST: + { + _, ok := other.Get_().(OrphanedV1Enum_FIRST) + return ok + } + case OrphanedV1Enum_SECOND: + { + _, ok := other.Get_().(OrphanedV1Enum_SECOND) + return ok + } + case OrphanedV1Enum_THIRD: + { + _, ok := other.Get_().(OrphanedV1Enum_THIRD) + return ok + } + default: + { + return false // unexpected + } + } +} + +func (_this OrphanedV1Enum) EqualsGeneric(other interface{}) bool { + typed, ok := other.(OrphanedV1Enum) + return ok && _this.Equals(typed) +} + +func Type_OrphanedV1Enum_() _dafny.TypeDescriptor { + return type_OrphanedV1Enum_{} +} + +type type_OrphanedV1Enum_ struct { +} + +func (_this type_OrphanedV1Enum_) Default() interface{} { + return Companion_OrphanedV1Enum_.Default() +} + +func (_this type_OrphanedV1Enum_) String() string { + return "SimpleOrphanedTypes.OrphanedV1Enum" +} +func (_this OrphanedV1Enum) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = OrphanedV1Enum{} + +// End of datatype OrphanedV1Enum + +// Definition of class ISimpleOrphanedClientCallHistory +type ISimpleOrphanedClientCallHistory struct { + dummy byte +} + +func New_ISimpleOrphanedClientCallHistory_() *ISimpleOrphanedClientCallHistory { + _this := ISimpleOrphanedClientCallHistory{} + + return &_this +} + +type CompanionStruct_ISimpleOrphanedClientCallHistory_ struct { +} + +var Companion_ISimpleOrphanedClientCallHistory_ = CompanionStruct_ISimpleOrphanedClientCallHistory_{} + +func (_this *ISimpleOrphanedClientCallHistory) Equals(other *ISimpleOrphanedClientCallHistory) bool { + return _this == other +} + +func (_this *ISimpleOrphanedClientCallHistory) EqualsGeneric(x interface{}) bool { + other, ok := x.(*ISimpleOrphanedClientCallHistory) + return ok && _this.Equals(other) +} + +func (*ISimpleOrphanedClientCallHistory) String() string { + return "SimpleOrphanedTypes.ISimpleOrphanedClientCallHistory" +} + +func Type_ISimpleOrphanedClientCallHistory_() _dafny.TypeDescriptor { + return type_ISimpleOrphanedClientCallHistory_{} +} + +type type_ISimpleOrphanedClientCallHistory_ struct { +} + +func (_this type_ISimpleOrphanedClientCallHistory_) Default() interface{} { + return (*ISimpleOrphanedClientCallHistory)(nil) +} + +func (_this type_ISimpleOrphanedClientCallHistory_) String() string { + return "SimpleOrphanedTypes.ISimpleOrphanedClientCallHistory" +} +func (_this *ISimpleOrphanedClientCallHistory) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &ISimpleOrphanedClientCallHistory{} + +// End of class ISimpleOrphanedClientCallHistory + +// Definition of trait ISimpleOrphanedClient +type ISimpleOrphanedClient interface { + String() string +} +type CompanionStruct_ISimpleOrphanedClient_ struct { + TraitID_ *_dafny.TraitID +} + +var Companion_ISimpleOrphanedClient_ = CompanionStruct_ISimpleOrphanedClient_{ + TraitID_: &_dafny.TraitID{}, +} + +func (CompanionStruct_ISimpleOrphanedClient_) CastTo_(x interface{}) ISimpleOrphanedClient { + var t ISimpleOrphanedClient + t, _ = x.(ISimpleOrphanedClient) + return t +} + +// End of trait ISimpleOrphanedClient + +// Definition of datatype SimpleOrphanedConfig +type SimpleOrphanedConfig struct { + Data_SimpleOrphanedConfig_ +} + +func (_this SimpleOrphanedConfig) Get_() Data_SimpleOrphanedConfig_ { + return _this.Data_SimpleOrphanedConfig_ +} + +type Data_SimpleOrphanedConfig_ interface { + isSimpleOrphanedConfig() +} + +type CompanionStruct_SimpleOrphanedConfig_ struct { +} + +var Companion_SimpleOrphanedConfig_ = CompanionStruct_SimpleOrphanedConfig_{} + +type SimpleOrphanedConfig_SimpleOrphanedConfig struct { + StructureMember m_Wrappers.Option +} + +func (SimpleOrphanedConfig_SimpleOrphanedConfig) isSimpleOrphanedConfig() {} + +func (CompanionStruct_SimpleOrphanedConfig_) Create_SimpleOrphanedConfig_(StructureMember m_Wrappers.Option) SimpleOrphanedConfig { + return SimpleOrphanedConfig{SimpleOrphanedConfig_SimpleOrphanedConfig{StructureMember}} +} + +func (_this SimpleOrphanedConfig) Is_SimpleOrphanedConfig() bool { + _, ok := _this.Get_().(SimpleOrphanedConfig_SimpleOrphanedConfig) + return ok +} + +func (CompanionStruct_SimpleOrphanedConfig_) Default() SimpleOrphanedConfig { + return Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(m_Wrappers.Companion_Option_.Default()) +} + +func (_this SimpleOrphanedConfig) Dtor_structureMember() m_Wrappers.Option { + return _this.Get_().(SimpleOrphanedConfig_SimpleOrphanedConfig).StructureMember +} + +func (_this SimpleOrphanedConfig) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case SimpleOrphanedConfig_SimpleOrphanedConfig: + { + return "SimpleOrphanedTypes.SimpleOrphanedConfig.SimpleOrphanedConfig" + "(" + _dafny.String(data.StructureMember) + ")" + } + default: + { + return "" + } + } +} + +func (_this SimpleOrphanedConfig) Equals(other SimpleOrphanedConfig) bool { + switch data1 := _this.Get_().(type) { + case SimpleOrphanedConfig_SimpleOrphanedConfig: + { + data2, ok := other.Get_().(SimpleOrphanedConfig_SimpleOrphanedConfig) + return ok && data1.StructureMember.Equals(data2.StructureMember) + } + default: + { + return false // unexpected + } + } +} + +func (_this SimpleOrphanedConfig) EqualsGeneric(other interface{}) bool { + typed, ok := other.(SimpleOrphanedConfig) + return ok && _this.Equals(typed) +} + +func Type_SimpleOrphanedConfig_() _dafny.TypeDescriptor { + return type_SimpleOrphanedConfig_{} +} + +type type_SimpleOrphanedConfig_ struct { +} + +func (_this type_SimpleOrphanedConfig_) Default() interface{} { + return Companion_SimpleOrphanedConfig_.Default() +} + +func (_this type_SimpleOrphanedConfig_) String() string { + return "SimpleOrphanedTypes.SimpleOrphanedConfig" +} +func (_this SimpleOrphanedConfig) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = SimpleOrphanedConfig{} + +// End of datatype SimpleOrphanedConfig + +// Definition of datatype Error +type Error struct { + Data_Error_ +} + +func (_this Error) Get_() Data_Error_ { + return _this.Data_Error_ +} + +type Data_Error_ interface { + isError() +} + +type CompanionStruct_Error_ struct { +} + +var Companion_Error_ = CompanionStruct_Error_{} + +type Error_OrphanedError struct { + Message _dafny.Sequence +} + +func (Error_OrphanedError) isError() {} + +func (CompanionStruct_Error_) Create_OrphanedError_(Message _dafny.Sequence) Error { + return Error{Error_OrphanedError{Message}} +} + +func (_this Error) Is_OrphanedError() bool { + _, ok := _this.Get_().(Error_OrphanedError) + return ok +} + +type Error_CollectionOfErrors struct { + List _dafny.Sequence + Message _dafny.Sequence +} + +func (Error_CollectionOfErrors) isError() {} + +func (CompanionStruct_Error_) Create_CollectionOfErrors_(List _dafny.Sequence, Message _dafny.Sequence) Error { + return Error{Error_CollectionOfErrors{List, Message}} +} + +func (_this Error) Is_CollectionOfErrors() bool { + _, ok := _this.Get_().(Error_CollectionOfErrors) + return ok +} + +type Error_Opaque struct { + Obj interface{} +} + +func (Error_Opaque) isError() {} + +func (CompanionStruct_Error_) Create_Opaque_(Obj interface{}) Error { + return Error{Error_Opaque{Obj}} +} + +func (_this Error) Is_Opaque() bool { + _, ok := _this.Get_().(Error_Opaque) + return ok +} + +type Error_OpaqueWithText struct { + Obj interface{} + ObjMessage _dafny.Sequence +} + +func (Error_OpaqueWithText) isError() {} + +func (CompanionStruct_Error_) Create_OpaqueWithText_(Obj interface{}, ObjMessage _dafny.Sequence) Error { + return Error{Error_OpaqueWithText{Obj, ObjMessage}} +} + +func (_this Error) Is_OpaqueWithText() bool { + _, ok := _this.Get_().(Error_OpaqueWithText) + return ok +} + +func (CompanionStruct_Error_) Default() Error { + return Companion_Error_.Create_OrphanedError_(_dafny.EmptySeq.SetString()) +} + +func (_this Error) Dtor_message() _dafny.Sequence { + switch data := _this.Get_().(type) { + case Error_OrphanedError: + return data.Message + default: + return data.(Error_CollectionOfErrors).Message + } +} + +func (_this Error) Dtor_list() _dafny.Sequence { + return _this.Get_().(Error_CollectionOfErrors).List +} + +func (_this Error) Dtor_obj() interface{} { + switch data := _this.Get_().(type) { + case Error_Opaque: + return data.Obj + default: + return data.(Error_OpaqueWithText).Obj + } +} + +func (_this Error) Dtor_objMessage() _dafny.Sequence { + return _this.Get_().(Error_OpaqueWithText).ObjMessage +} + +func (_this Error) String() string { + switch data := _this.Get_().(type) { + case nil: + return "null" + case Error_OrphanedError: + { + return "SimpleOrphanedTypes.Error.OrphanedError" + "(" + _dafny.String(data.Message) + ")" + } + case Error_CollectionOfErrors: + { + return "SimpleOrphanedTypes.Error.CollectionOfErrors" + "(" + _dafny.String(data.List) + ", " + _dafny.String(data.Message) + ")" + } + case Error_Opaque: + { + return "SimpleOrphanedTypes.Error.Opaque" + "(" + _dafny.String(data.Obj) + ")" + } + case Error_OpaqueWithText: + { + return "SimpleOrphanedTypes.Error.OpaqueWithText" + "(" + _dafny.String(data.Obj) + ", " + _dafny.String(data.ObjMessage) + ")" + } + default: + { + return "" + } + } +} + +func (_this Error) Equals(other Error) bool { + switch data1 := _this.Get_().(type) { + case Error_OrphanedError: + { + data2, ok := other.Get_().(Error_OrphanedError) + return ok && data1.Message.Equals(data2.Message) + } + case Error_CollectionOfErrors: + { + data2, ok := other.Get_().(Error_CollectionOfErrors) + return ok && data1.List.Equals(data2.List) && data1.Message.Equals(data2.Message) + } + case Error_Opaque: + { + data2, ok := other.Get_().(Error_Opaque) + return ok && _dafny.AreEqual(data1.Obj, data2.Obj) + } + case Error_OpaqueWithText: + { + data2, ok := other.Get_().(Error_OpaqueWithText) + return ok && _dafny.AreEqual(data1.Obj, data2.Obj) && data1.ObjMessage.Equals(data2.ObjMessage) + } + default: + { + return false // unexpected + } + } +} + +func (_this Error) EqualsGeneric(other interface{}) bool { + typed, ok := other.(Error) + return ok && _this.Equals(typed) +} + +func Type_Error_() _dafny.TypeDescriptor { + return type_Error_{} +} + +type type_Error_ struct { +} + +func (_this type_Error_) Default() interface{} { + return Companion_Error_.Default() +} + +func (_this type_Error_) String() string { + return "SimpleOrphanedTypes.Error" +} +func (_this Error) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = Error{} + +// End of datatype Error + +// Definition of class OpaqueError +type OpaqueError struct { +} + +func New_OpaqueError_() *OpaqueError { + _this := OpaqueError{} + + return &_this +} + +type CompanionStruct_OpaqueError_ struct { +} + +var Companion_OpaqueError_ = CompanionStruct_OpaqueError_{} + +func (*OpaqueError) String() string { + return "SimpleOrphanedTypes.OpaqueError" +} + +// End of class OpaqueError + +func Type_OpaqueError_() _dafny.TypeDescriptor { + return type_OpaqueError_{} +} + +type type_OpaqueError_ struct { +} + +func (_this type_OpaqueError_) Default() interface{} { + return Companion_Error_.Default() +} + +func (_this type_OpaqueError_) String() string { + return "SimpleOrphanedTypes.OpaqueError" +} +func (_this *CompanionStruct_OpaqueError_) Is_(__source Error) bool { + var _0_e Error = (__source) + _ = _0_e + return ((_0_e).Is_Opaque()) || ((_0_e).Is_OpaqueWithText()) +} + +// Definition of class DummySubsetType +type DummySubsetType struct { +} + +func New_DummySubsetType_() *DummySubsetType { + _this := DummySubsetType{} + + return &_this +} + +type CompanionStruct_DummySubsetType_ struct { +} + +var Companion_DummySubsetType_ = CompanionStruct_DummySubsetType_{} + +func (*DummySubsetType) String() string { + return "SimpleOrphanedTypes.DummySubsetType" +} +func (_this *CompanionStruct_DummySubsetType_) Witness() _dafny.Int { + return _dafny.One +} + +// End of class DummySubsetType + +func Type_DummySubsetType_() _dafny.TypeDescriptor { + return type_DummySubsetType_{} +} + +type type_DummySubsetType_ struct { +} + +func (_this type_DummySubsetType_) Default() interface{} { + return Companion_DummySubsetType_.Witness() +} + +func (_this type_DummySubsetType_) String() string { + return "SimpleOrphanedTypes.DummySubsetType" +} +func (_this *CompanionStruct_DummySubsetType_) Is_(__source _dafny.Int) bool { + var _1_x _dafny.Int = (__source) + _ = _1_x + return Companion_Default___.IsDummySubsetType(_1_x) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/WrappedSimpleOrphanedService/shim.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/WrappedSimpleOrphanedService/shim.go new file mode 100644 index 0000000000..3a19ee0ce1 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/WrappedSimpleOrphanedService/shim.go @@ -0,0 +1,23 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package WrappedSimpleOrphanedService + +import ( + "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygenerated" +) + +type Shim struct { + SimpleOrphanedTypes.ISimpleOrphanedClient + client *simpleorphanedsmithygenerated.Client +} + +func (_static *CompanionStruct_Default___) WrappedSimpleOrphaned(inputConfig SimpleOrphanedTypes.SimpleOrphanedConfig) Wrappers.Result { + var nativeConfig = simpleorphanedsmithygenerated.SimpleOrphanedConfig_FromDafny(inputConfig) + var nativeClient, nativeError = simpleorphanedsmithygenerated.NewClient(nativeConfig) + if nativeError != nil { + return Wrappers.Companion_Result_.Create_Failure_(SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeError)) + } + return Wrappers.Companion_Result_.Create_Success_(&Shim{client: nativeClient}) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/go.mod b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/go.mod new file mode 100644 index 0000000000..7b5f8db98d --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/go.mod @@ -0,0 +1,10 @@ +module github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes + +go 1.23.0 + +require ( + github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1 + github.com/dafny-lang/DafnyStandardLibGo v0.0.0 +) + +replace github.com/dafny-lang/DafnyStandardLibGo => ../../../../dafny-dependencies/StandardLibrary/runtimes/go/ImplementationFromDafny-go/ diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/shim.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/shim.go new file mode 100644 index 0000000000..782d87a636 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/shim.go @@ -0,0 +1,52 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package WrappedSimpleOrphanedService + +import ( + "context" + + "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygenerated" +) + +type Shim struct { + SimpleOrphanedTypes.ISimpleOrphanedClient + client *simpleorphanedsmithygenerated.Client +} + +func (_static *CompanionStruct_Default___) WrappedSimpleOrphaned(inputConfig SimpleOrphanedTypes.SimpleOrphanedConfig) Wrappers.Result { + var nativeConfig = simpleorphanedsmithygenerated.SimpleOrphanedConfig_FromDafny(inputConfig) + var nativeClient, nativeError = simpleorphanedsmithygenerated.NewClient(nativeConfig) + if nativeError != nil { + return Wrappers.Companion_Result_.Create_Failure_(SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeError)) + } + return Wrappers.Companion_Result_.Create_Success_(&Shim{client: nativeClient}) +} + +func (shim *Shim) CreateOrphanedStructure(input SimpleOrphanedTypes.CreateOrphanedStructureInput) Wrappers.Result { + var native_request = simpleorphanedsmithygenerated.CreateOrphanedStructureInput_FromDafny(input) + var native_response, native_error = shim.client.CreateOrphanedStructure(context.Background(), native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedStructureOutput_ToDafny(*native_response)) +} + +func (shim *Shim) CreateOrphanedResource(input SimpleOrphanedTypes.CreateOrphanedResourceInput) Wrappers.Result { + var native_request = simpleorphanedsmithygenerated.CreateOrphanedResourceInput_FromDafny(input) + var native_response, native_error = shim.client.CreateOrphanedResource(context.Background(), native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedResourceOutput_ToDafny(*native_response)) +} + +func (shim *Shim) CreateOrphanedError(input SimpleOrphanedTypes.CreateOrphanedErrorInput) Wrappers.Result { + var native_request = simpleorphanedsmithygenerated.CreateOrphanedErrorInput_FromDafny(input) + var native_response, native_error = shim.client.CreateOrphanedError(context.Background(), native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedErrorOutput_ToDafny(*native_response)) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go new file mode 100644 index 0000000000..9418326060 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go @@ -0,0 +1,25 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +type OrphanedResource struct { + Impl SimpleOrphanedTypes.IOrphanedResource +} + +func (this *OrphanedResource) OrphanedResourceOperation(params simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput) (*simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput, error) { + var dafny_request SimpleOrphanedTypes.OrphanedResourceOperationInput = OrphanedResourceOperationInput_ToDafny(params) + var dafny_response = this.Impl.OrphanedResourceOperation(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(SimpleOrphanedTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = OrphanedResourceOperationOutput_FromDafny(dafny_response.Dtor_value().(SimpleOrphanedTypes.OrphanedResourceOperationOutput)) + return &native_response, nil + +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go new file mode 100644 index 0000000000..98fdb52ec9 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go @@ -0,0 +1,23 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +type OrphanedResourceNativeWrapper struct { + SimpleOrphanedTypes.IOrphanedResource + Impl simpleorphanedsmithygeneratedtypes.IOrphanedResource +} + +func (this *OrphanedResourceNativeWrapper) OrphanedResourceOperation(input SimpleOrphanedTypes.OrphanedResourceOperationInput) Wrappers.Result { + var native_request = OrphanedResourceOperationInput_FromDafny(input) + var native_response, native_error = this.Impl.OrphanedResourceOperation(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(OrphanedResourceOperationOutput_ToDafny(*native_response)) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/api_client.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/api_client.go new file mode 100644 index 0000000000..f40b82ca89 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/api_client.go @@ -0,0 +1,24 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +type Client struct { + DafnyClient SimpleOrphanedTypes.ISimpleOrphanedClient +} + +func NewClient(clientConfig simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig) (*Client, error) { + var dafnyConfig = SimpleOrphanedConfig_ToDafny(clientConfig) + var dafny_response = SimpleOrphaned.Companion_Default___.SimpleOrphaned(dafnyConfig) + if dafny_response.Is_Failure() { + panic("Client construction failed. This should never happen") + } + var dafnyClient = dafny_response.Extract().(SimpleOrphanedTypes.ISimpleOrphanedClient) + client := &Client{dafnyClient} + return client, nil +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go new file mode 100644 index 0000000000..52358df9e6 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go @@ -0,0 +1,128 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +func OrphanedResourceOperationInput_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput) SimpleOrphanedTypes.OrphanedResourceOperationInput { + + return func() SimpleOrphanedTypes.OrphanedResourceOperationInput { + + return SimpleOrphanedTypes.Companion_OrphanedResourceOperationInput_.Create_OrphanedResourceOperationInput_(simple_orphaned_OrphanedResourceOperationInput_someString_ToDafny(nativeInput.SomeString)) + }() + +} + +func OrphanedResourceOperationOutput_ToDafny(nativeOutput simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput) SimpleOrphanedTypes.OrphanedResourceOperationOutput { + + return func() SimpleOrphanedTypes.OrphanedResourceOperationOutput { + + return SimpleOrphanedTypes.Companion_OrphanedResourceOperationOutput_.Create_OrphanedResourceOperationOutput_(simple_orphaned_OrphanedResourceOperationOutput_someString_ToDafny(nativeOutput.SomeString)) + }() + +} + +func OrphanedResource_ToDafny(nativeResource simpleorphanedsmithygeneratedtypes.IOrphanedResource) SimpleOrphanedTypes.IOrphanedResource { + val, ok := nativeResource.(*OrphanedResource) + if ok { + return val.Impl + } + return OrphanedResource{&OrphanedResourceNativeWrapper{Impl: nativeResource}}.Impl + +} + +func OrphanedError_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OrphanedError) SimpleOrphanedTypes.Error { + return func() SimpleOrphanedTypes.Error { + + return SimpleOrphanedTypes.Companion_Error_.Create_OrphanedError_(simple_orphaned_OrphanedError_message_ToDafny(nativeInput.Message)) + }() + +} + +func CollectionOfErrors_Input_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.CollectionOfErrors) SimpleOrphanedTypes.Error { + var e []interface{} + for _, i2 := range nativeInput.ListOfErrors { + e = append(e, Error_ToDafny(i2)) + } + return SimpleOrphanedTypes.Companion_Error_.Create_CollectionOfErrors_(dafny.SeqOf(e...), dafny.SeqOfChars([]dafny.Char(nativeInput.Message)...)) +} +func OpaqueError_Input_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OpaqueError) SimpleOrphanedTypes.Error { + return SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeInput.ErrObject) +} + +func Error_ToDafny(err error) SimpleOrphanedTypes.Error { + switch err.(type) { + // Service Errors + case simpleorphanedsmithygeneratedtypes.OrphanedError: + return OrphanedError_ToDafny(err.(simpleorphanedsmithygeneratedtypes.OrphanedError)) + + //DependentErrors + + //Unmodelled Errors + case simpleorphanedsmithygeneratedtypes.CollectionOfErrors: + return CollectionOfErrors_Input_ToDafny(err.(simpleorphanedsmithygeneratedtypes.CollectionOfErrors)) + + default: + error, ok := err.(simpleorphanedsmithygeneratedtypes.OpaqueError) + if !ok { + panic("Error is not an OpaqueError") + } + return OpaqueError_Input_ToDafny(error) + } +} + +func SimpleOrphanedConfig_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig) SimpleOrphanedTypes.SimpleOrphanedConfig { + return func() SimpleOrphanedTypes.SimpleOrphanedConfig { + + return SimpleOrphanedTypes.Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(simple_orphaned_SimpleOrphanedConfig_structureMember_ToDafny(nativeInput.StructureMember)) + }() + +} + +func simple_orphaned_SimpleOrphanedConfig_structureMember_ToDafny(input *simpleorphanedsmithygeneratedtypes.OrphanedConfigShape) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(SimpleOrphanedTypes.Companion_OrphanedConfigShape_.Create_OrphanedConfigShape_(simple_orphaned_OrphanedConfigShape_stringMember_ToDafny(input.StringMember))) + }() +} + +func simple_orphaned_OrphanedError_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func simple_orphaned_OrphanedConfigShape_stringMember_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func simple_orphaned_OrphanedResourceOperationInput_someString_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func simple_orphaned_OrphanedResourceOperationOutput_someString_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_native.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_native.go new file mode 100644 index 0000000000..2a951e89ca --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_native.go @@ -0,0 +1,156 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +func OrphanedResourceOperationInput_FromDafny(dafnyInput SimpleOrphanedTypes.OrphanedResourceOperationInput) simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput { + + return simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput{SomeString: simple_orphaned_OrphanedResourceOperationInput_someString_FromDafny(dafnyInput.Dtor_someString().UnwrapOr(nil))} + +} + +func OrphanedResourceOperationOutput_FromDafny(dafnyOutput SimpleOrphanedTypes.OrphanedResourceOperationOutput) simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput { + + return simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput{SomeString: simple_orphaned_OrphanedResourceOperationOutput_someString_FromDafny(dafnyOutput.Dtor_someString().UnwrapOr(nil))} + +} + +func OrphanedResource_FromDafny(dafnyResource SimpleOrphanedTypes.IOrphanedResource) simpleorphanedsmithygeneratedtypes.IOrphanedResource { + val, ok := dafnyResource.(*OrphanedResourceNativeWrapper) + if ok { + return val.Impl + } + + return &OrphanedResource{dafnyResource} +} + +func OrphanedError_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.OrphanedError { + return simpleorphanedsmithygeneratedtypes.OrphanedError{Message: simple_orphaned_OrphanedError_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func CollectionOfErrors_Output_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.CollectionOfErrors { + listOfErrors := dafnyOutput.Dtor_list() + message := dafnyOutput.Dtor_message() + t := simpleorphanedsmithygeneratedtypes.CollectionOfErrors{} + for i := dafny.Iterate(listOfErrors); ; { + val, ok := i() + if !ok { + break + } + err := val.(SimpleOrphanedTypes.Error) + t.ListOfErrors = append(t.ListOfErrors, Error_FromDafny(err)) + + } + t.Message = func() string { + var s string + for i := dafny.Iterate(message); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() + return t +} +func OpaqueError_Output_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.OpaqueError { + return simpleorphanedsmithygeneratedtypes.OpaqueError{ + ErrObject: dafnyOutput.Dtor_obj(), + } +} + +func Error_FromDafny(err SimpleOrphanedTypes.Error) error { + // Service Errors + if err.Is_OrphanedError() { + return OrphanedError_FromDafny(err) + } + + //DependentErrors + + //Unmodelled Errors + if err.Is_CollectionOfErrors() { + return CollectionOfErrors_Output_FromDafny(err) + } + + return OpaqueError_Output_FromDafny(err) +} + +func SimpleOrphanedConfig_FromDafny(dafnyOutput SimpleOrphanedTypes.SimpleOrphanedConfig) simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig { + return simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig{StructureMember: simple_orphaned_SimpleOrphanedConfig_structureMember_FromDafny(dafnyOutput.Dtor_structureMember().UnwrapOr(nil))} + +} + +func simple_orphaned_SimpleOrphanedConfig_structureMember_FromDafny(input interface{}) *simpleorphanedsmithygeneratedtypes.OrphanedConfigShape { + if input == nil { + return nil + } + return &simpleorphanedsmithygeneratedtypes.OrphanedConfigShape{StringMember: simple_orphaned_OrphanedConfigShape_stringMember_FromDafny(input.(SimpleOrphanedTypes.OrphanedConfigShape).Dtor_stringMember().UnwrapOr(nil))} +} +func simple_orphaned_OrphanedError_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func simple_orphaned_OrphanedConfigShape_stringMember_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func simple_orphaned_OrphanedResourceOperationInput_someString_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func simple_orphaned_OrphanedResourceOperationOutput_someString_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go new file mode 100644 index 0000000000..b2f3fea8f5 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go @@ -0,0 +1,19 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygeneratedtypes + +type OrphanedV1Enum string + +const ( + OrphanedV1EnumFirst OrphanedV1Enum = "0x0014" + OrphanedV1EnumSecond OrphanedV1Enum = "0x0046" + OrphanedV1EnumThird OrphanedV1Enum = "0x0078" +) + +func (OrphanedV1Enum) Values() []OrphanedV1Enum { + return []OrphanedV1Enum{ + "0x0014", + "0x0046", + "0x0078", + } +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go new file mode 100644 index 0000000000..7db66d4f95 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go @@ -0,0 +1,17 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygeneratedtypes + +import ( + "fmt" +) + +type OrphanedError struct { + SimpleOrphanedBaseException + Message string + ErrorCodeOverride *string +} + +func (e OrphanedError) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go new file mode 100644 index 0000000000..5fb450e2aa --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go @@ -0,0 +1,177 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygeneratedtypes + +import ( + "fmt" +) + +type CreateOrphanedErrorInput struct { +} + +func (input CreateOrphanedErrorInput) Validate() error { + + return nil +} + +type CreateOrphanedErrorOutput struct { +} + +func (input CreateOrphanedErrorOutput) Validate() error { + + return nil +} + +type CreateOrphanedResourceInput struct { +} + +func (input CreateOrphanedResourceInput) Validate() error { + + return nil +} + +type CreateOrphanedResourceOutput struct { +} + +func (input CreateOrphanedResourceOutput) Validate() error { + + return nil +} + +type CreateOrphanedStructureInput struct { +} + +func (input CreateOrphanedStructureInput) Validate() error { + + return nil +} + +type CreateOrphanedStructureOutput struct { +} + +func (input CreateOrphanedStructureOutput) Validate() error { + + return nil +} + +type OrphanedConfigShape struct { + StringMember *string +} + +func (input OrphanedConfigShape) Validate() error { + + return nil +} + +type OrphanedResourceOperationInput struct { + SomeString *string +} + +func (input OrphanedResourceOperationInput) Validate() error { + + return nil +} + +type OrphanedResourceOperationOutput struct { + SomeString *string +} + +func (input OrphanedResourceOperationOutput) Validate() error { + + return nil +} + +type OrphanedResourceReference struct { +} + +func (input OrphanedResourceReference) Validate() error { + + return nil +} + +type OrphanedStructure struct { + BlobValue []byte + + BooleanValue *bool + + EnumValue *OrphanedV1Enum + + IntegerValue *int32 + + ListValue []string + + LongValue *int64 + + MapValue map[string]string + + StringValue *string + + UnionValue OrphanedUnion +} + +func (input OrphanedStructure) Validate() error { + if input.simple_orphaned_OrphanedStructure_unionValue_Validate() != nil { + return input.simple_orphaned_OrphanedStructure_unionValue_Validate() + } + + return nil +} + +func (input OrphanedStructure) simple_orphaned_OrphanedStructure_unionValue_Validate() error { + if input.UnionValue == nil { + return nil + } + switch unionType := input.UnionValue.(type) { + case *OrphanedUnionMemberintegerValue: + case *OrphanedUnionMemberstringValue: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type SimpleOrphanedConfig struct { + StructureMember *OrphanedConfigShape +} + +func (input SimpleOrphanedConfig) Validate() error { + if input.StructureMember != nil { + if input.StructureMember.Validate() != nil { + return input.StructureMember.Validate() + } + + } + + return nil +} + +// OrphanedUnionMemberintegerValue +// OrphanedUnionMemberstringValue +type OrphanedUnion interface { + isOrphanedUnion() +} + +type OrphanedUnionMemberintegerValue struct { + Value int32 +} + +func (*OrphanedUnionMemberintegerValue) isOrphanedUnion() {} + +type OrphanedUnionMemberstringValue struct { + Value string +} + +func (*OrphanedUnionMemberstringValue) isOrphanedUnion() {} + +type SimpleOrphanedBaseException interface { + // This is a dummy method to allow type assertion since Go empty interfaces + // aren't useful for type assertion checks. No concrete class is expected to implement + // this method. This is also not exported. + interfaceBindingMethod() +} + +type IOrphanedResource interface { + OrphanedResourceOperation(OrphanedResourceOperationInput) (*OrphanedResourceOperationOutput, error) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go new file mode 100644 index 0000000000..982a370aff --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go @@ -0,0 +1,26 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygeneratedtypes + +import ( + "fmt" +) + +type CollectionOfErrors struct { + SimpleOrphanedBaseException + ListOfErrors []error + Message string +} + +func (e CollectionOfErrors) Error() string { + return fmt.Sprintf("message: %s\n err %v", e.Message, e.ListOfErrors) +} + +type OpaqueError struct { + SimpleOrphanedBaseException + ErrObject interface{} +} + +func (e OpaqueError) Error() string { + return fmt.Sprintf("message: %v", e.ErrObject) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/ExternDefinitions.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/ExternDefinitions.go new file mode 100644 index 0000000000..1b272edc9d --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/ExternDefinitions.go @@ -0,0 +1,129 @@ +// Package ExternDefinitions +// Dafny module ExternDefinitions compiled into Go + +package ExternDefinitions + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" + m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" + m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" + m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + m_WrappedSimpleOrphanedService "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/WrappedSimpleOrphanedService" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_SimpleOrphanedTypes.Dummy__ +var _ m_SimpleOrphanedImpl.Dummy__ +var _ m_SimpleOrphaned.Dummy__ +var _ m_OrphanedResource.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_WrappedSimpleOrphanedService.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "ExternDefinitions.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) TestOrphanedStructure() { + var _0_uninitializedStructure m_SimpleOrphanedTypes.OrphanedStructure + _ = _0_uninitializedStructure + _0_uninitializedStructure = m_SimpleOrphanedTypes.Companion_OrphanedStructure_.Create_OrphanedStructure_(m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) + var _1_initializedStructure m_SimpleOrphanedTypes.OrphanedStructure + _ = _1_initializedStructure + var _out0 m_SimpleOrphanedTypes.OrphanedStructure + _ = _out0 + _out0 = Companion_Default___.InitializeOrphanedStructure(_0_uninitializedStructure) + _1_initializedStructure = _out0 + if !(((_1_initializedStructure).Dtor_stringValue()).Is_Some()) { + panic("test/ExternDefinitions.dfy(16,4): " + (_dafny.SeqOfString("expectation violation")).String()) + } + if !(_dafny.Companion_Sequence_.Equal(((_1_initializedStructure).Dtor_stringValue()).Dtor_value().(_dafny.Sequence), _dafny.SeqOfString("the extern MUST use Smithy-generated conversions to set this value in the native structure"))) { + panic("test/ExternDefinitions.dfy(17,4): " + (_dafny.SeqOfString("expectation violation")).String()) + } +} +func (_static *CompanionStruct_Default___) TestOrphanedResource() { + var _0_resource *m_OrphanedResource.OrphanedResource + _ = _0_resource + var _nw0 *m_OrphanedResource.OrphanedResource = m_OrphanedResource.New_OrphanedResource_() + _ = _nw0 + _nw0.Ctor__() + _0_resource = _nw0 + var _1_ret m_Wrappers.Result + _ = _1_ret + var _out0 m_Wrappers.Result + _ = _out0 + _out0 = Companion_Default___.CallNativeOrphanedResource(_0_resource) + _1_ret = _out0 + if !((_1_ret).Is_Success()) { + panic("test/ExternDefinitions.dfy(25,4): " + (_dafny.SeqOfString("expectation violation")).String()) + } + if !((((_1_ret).Dtor_value().(m_SimpleOrphanedTypes.OrphanedResourceOperationOutput)).Dtor_someString()).Is_Some()) { + panic("test/ExternDefinitions.dfy(26,4): " + (_dafny.SeqOfString("expectation violation")).String()) + } + if !(_dafny.Companion_Sequence_.Equal((((_1_ret).Dtor_value().(m_SimpleOrphanedTypes.OrphanedResourceOperationOutput)).Dtor_someString()).Dtor_value().(_dafny.Sequence), _dafny.SeqOfString("correct string"))) { + panic("test/ExternDefinitions.dfy(27,4): " + (_dafny.SeqOfString("expectation violation")).String()) + } +} +func (_static *CompanionStruct_Default___) TestOrphanedError() { + var _0_error m_SimpleOrphanedTypes.Error + _ = _0_error + _0_error = m_SimpleOrphanedTypes.Companion_Error_.Create_OrphanedError_(_dafny.SeqOfString("TBD")) + var _1_out__error m_SimpleOrphanedTypes.Error + _ = _1_out__error + var _out0 m_SimpleOrphanedTypes.Error + _ = _out0 + _out0 = Companion_Default___.CallNativeOrphanedError(_0_error) + _1_out__error = _out0 + if !((_1_out__error).Is_OrphanedError()) { + panic("test/ExternDefinitions.dfy(35,4): " + (_dafny.SeqOfString("expectation violation")).String()) + } + if !(_dafny.Companion_Sequence_.Equal((_1_out__error).Dtor_message(), _dafny.SeqOfString("the extern MUST use Smithy-generated conversions to set this value in the native error"))) { + panic("test/ExternDefinitions.dfy(36,4): " + (_dafny.SeqOfString("expectation violation")).String()) + } +} + +// End of class Default__ diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go new file mode 100644 index 0000000000..92c805b941 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go @@ -0,0 +1,40 @@ +package ExternDefinitions + +import ( + "fmt" + + Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" + SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + simpleorphanedsmithygenerated "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygenerated" + simpleorphanedsmithygeneratedtypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +var _ Wrappers.Dummy__ + +func (CompanionStruct_Default___) InitializeOrphanedStructure(input SimpleOrphanedTypes.OrphanedStructure) SimpleOrphanedTypes.OrphanedStructure { + // Missing Structure converter + return input +} + +func (CompanionStruct_Default___) CallNativeOrphanedResource(input *OrphanedResource.OrphanedResource) Wrappers.Result { + native_resource := simpleorphanedsmithygenerated.OrphanedResource_FromDafny(input) + fmt.Printf("Type of native_resource: %T\n", native_resource) + someString := "the extern MUST provide this string to the native resource's operation" + fmt.Printf("Type of someString: %T\n", someString) + fmt.Printf("Type of &someString: %T\n", &someString) + native_output, err := native_resource.OrphanedResourceOperation(simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput{SomeString: &someString}) + fmt.Printf("Type of native_output: %T\n", native_output) + if err != nil { + return Wrappers.Companion_Result_.Create_Failure_(err) + } + dafny_output := simpleorphanedsmithygenerated.OrphanedResourceOperationOutput_ToDafny(*native_output) + return Wrappers.Companion_Result_.Create_Success_(dafny_output) +} + +func (CompanionStruct_Default___) CallNativeOrphanedError(input SimpleOrphanedTypes.Error) SimpleOrphanedTypes.Error { + native_error := simpleorphanedsmithygenerated.Error_FromDafny(input) + native_error.Message = "the extern MUST use Smithy-generated conversions to set this value in the native error" + dafny_error_again := simpleorphanedsmithygenerated.Error_ToDafny(native_error) + return dafny_error_again +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny-go.dtr b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny-go.dtr new file mode 100644 index 0000000000..2091a168d9 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny-go.dtr @@ -0,0 +1,14 @@ +file_format_version = "1.0" +dafny_version = "4.9.0.0" +[options_by_module.WrappedAbstractSimpleOrphanedService] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test" +legacy-module-names = false +[options_by_module.WrappedSimpleOrphanedService] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test" +legacy-module-names = false +[options_by_module.ExternDefinitions] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test" +legacy-module-names = false +[options_by_module.WrappedTest] +go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test" +legacy-module-names = false diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny.go new file mode 100644 index 0000000000..60b91afb37 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny.go @@ -0,0 +1,144 @@ +// Dafny program the_program compiled into Go +package main + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" + m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" + m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" + m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + m_ExternDefinitions "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/ExternDefinitions" + m_WrappedSimpleOrphanedService "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/WrappedSimpleOrphanedService" + m_WrappedTest "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/WrappedTest" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_SimpleOrphanedTypes.Dummy__ +var _ m_SimpleOrphanedImpl.Dummy__ +var _ m_SimpleOrphaned.Dummy__ +var _ m_OrphanedResource.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_WrappedSimpleOrphanedService.Dummy__ +var _ m_ExternDefinitions.Dummy__ +var _ m_WrappedTest.Dummy__ + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "_module.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) Test____Main____(__noArgsParameter _dafny.Sequence) { + var _0_success bool + _ = _0_success + _0_success = true + _dafny.Print((_dafny.SeqOfString("WrappedTest.TestOrphanedStructure: ")).SetString()) + func() { + defer func() { + if r := recover(); r != nil { + var _1_haltMessage = _dafny.SeqOfString(r.(string)) + { + _dafny.Print((_dafny.SeqOfString("FAILED\n ")).SetString()) + _dafny.Print((_1_haltMessage).SetString()) + _dafny.Print((_dafny.SeqOfString("\n")).SetString()) + _0_success = false + } + } + }() + { + m_WrappedTest.Companion_Default___.TestOrphanedStructure() + { + _dafny.Print((_dafny.SeqOfString("PASSED\n")).SetString()) + } + } + }() + _dafny.Print((_dafny.SeqOfString("WrappedTest.TestOrphanedResource: ")).SetString()) + func() { + defer func() { + if r := recover(); r != nil { + var _2_haltMessage = _dafny.SeqOfString(r.(string)) + { + _dafny.Print((_dafny.SeqOfString("FAILED\n ")).SetString()) + _dafny.Print((_2_haltMessage).SetString()) + _dafny.Print((_dafny.SeqOfString("\n")).SetString()) + _0_success = false + } + } + }() + { + m_WrappedTest.Companion_Default___.TestOrphanedResource() + { + _dafny.Print((_dafny.SeqOfString("PASSED\n")).SetString()) + } + } + }() + _dafny.Print((_dafny.SeqOfString("WrappedTest.TestOrphanedError: ")).SetString()) + func() { + defer func() { + if r := recover(); r != nil { + var _3_haltMessage = _dafny.SeqOfString(r.(string)) + { + _dafny.Print((_dafny.SeqOfString("FAILED\n ")).SetString()) + _dafny.Print((_3_haltMessage).SetString()) + _dafny.Print((_dafny.SeqOfString("\n")).SetString()) + _0_success = false + } + } + }() + { + m_WrappedTest.Companion_Default___.TestOrphanedError() + { + _dafny.Print((_dafny.SeqOfString("PASSED\n")).SetString()) + } + } + }() + if !(_0_success) { + panic("(1,0): " + (_dafny.SeqOfString("Test failures occurred: see above.\n")).String()) + } +} + +// End of class Default__ +func main() { + defer _dafny.CatchHalt() + Companion_Default___.Test____Main____(_dafny.FromMainArguments(os.Args)) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/WrappedSimpleOrphanedService.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/WrappedSimpleOrphanedService.go new file mode 100644 index 0000000000..44835ff2f8 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/WrappedSimpleOrphanedService.go @@ -0,0 +1,73 @@ +// Package WrappedSimpleOrphanedService +// Dafny module WrappedSimpleOrphanedService compiled into Go + +package WrappedSimpleOrphanedService + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" + m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" + m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" + m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_SimpleOrphanedTypes.Dummy__ +var _ m_SimpleOrphanedImpl.Dummy__ +var _ m_SimpleOrphaned.Dummy__ +var _ m_OrphanedResource.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "WrappedSimpleOrphanedService.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) WrappedDefaultSimpleOrphanedConfig() m_SimpleOrphanedTypes.SimpleOrphanedConfig { + return m_SimpleOrphanedTypes.Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(m_Wrappers.Companion_Option_.Create_None_()) +} + +// End of class Default__ diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/shim.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/shim.go new file mode 100644 index 0000000000..3a19ee0ce1 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/shim.go @@ -0,0 +1,23 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package WrappedSimpleOrphanedService + +import ( + "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygenerated" +) + +type Shim struct { + SimpleOrphanedTypes.ISimpleOrphanedClient + client *simpleorphanedsmithygenerated.Client +} + +func (_static *CompanionStruct_Default___) WrappedSimpleOrphaned(inputConfig SimpleOrphanedTypes.SimpleOrphanedConfig) Wrappers.Result { + var nativeConfig = simpleorphanedsmithygenerated.SimpleOrphanedConfig_FromDafny(inputConfig) + var nativeClient, nativeError = simpleorphanedsmithygenerated.NewClient(nativeConfig) + if nativeError != nil { + return Wrappers.Companion_Result_.Create_Failure_(SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeError)) + } + return Wrappers.Companion_Result_.Create_Success_(&Shim{client: nativeClient}) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedTest/WrappedTest.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedTest/WrappedTest.go new file mode 100644 index 0000000000..e0c2fa2e38 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedTest/WrappedTest.go @@ -0,0 +1,83 @@ +// Package WrappedTest +// Dafny module WrappedTest compiled into Go + +package WrappedTest + +import ( + os "os" + + m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" + _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" + m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" + m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" + m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" + m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" + m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" + m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + m_ExternDefinitions "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/ExternDefinitions" + m_WrappedSimpleOrphanedService "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/WrappedSimpleOrphanedService" +) + +var _ = os.Args +var _ _dafny.Dummy__ +var _ m__System.Dummy__ +var _ m_Wrappers.Dummy__ +var _ m_StandardLibrary_UInt.Dummy__ +var _ m_StandardLibrary.Dummy__ +var _ m_SimpleOrphanedTypes.Dummy__ +var _ m_SimpleOrphanedImpl.Dummy__ +var _ m_SimpleOrphaned.Dummy__ +var _ m_OrphanedResource.Dummy__ +var _ m_StandardLibraryInterop.Dummy__ +var _ m_WrappedSimpleOrphanedService.Dummy__ +var _ m_ExternDefinitions.Dummy__ + +type Dummy__ struct{} + +// Definition of class Default__ +type Default__ struct { + dummy byte +} + +func New_Default___() *Default__ { + _this := Default__{} + + return &_this +} + +type CompanionStruct_Default___ struct { +} + +var Companion_Default___ = CompanionStruct_Default___{} + +func (_this *Default__) Equals(other *Default__) bool { + return _this == other +} + +func (_this *Default__) EqualsGeneric(x interface{}) bool { + other, ok := x.(*Default__) + return ok && _this.Equals(other) +} + +func (*Default__) String() string { + return "WrappedTest.Default__" +} +func (_this *Default__) ParentTraits_() []*_dafny.TraitID { + return [](*_dafny.TraitID){} +} + +var _ _dafny.TraitOffspring = &Default__{} + +func (_static *CompanionStruct_Default___) TestOrphanedStructure() { + m_ExternDefinitions.Companion_Default___.TestOrphanedStructure() +} +func (_static *CompanionStruct_Default___) TestOrphanedResource() { + m_ExternDefinitions.Companion_Default___.TestOrphanedResource() +} +func (_static *CompanionStruct_Default___) TestOrphanedError() { + m_ExternDefinitions.Companion_Default___.TestOrphanedError() +} + +// End of class Default__ diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.mod b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.mod new file mode 100644 index 0000000000..349df89cc9 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.mod @@ -0,0 +1,14 @@ +module github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test + +go 1.23.0 + +require github.com/dafny-lang/DafnyStandardLibGo v0.0.0 + +require ( + github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1 + github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes v0.0.0 +) + +replace github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes v0.0.0 => ../ImplementationFromDafny-go + +replace github.com/dafny-lang/DafnyStandardLibGo => ../../../../dafny-dependencies/StandardLibrary/runtimes/go/ImplementationFromDafny-go/ diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.sum b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.sum new file mode 100644 index 0000000000..229929b8c5 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.sum @@ -0,0 +1,2 @@ +github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1 h1:dOgaw3i0I9nWKPjfXYzEfgWsVRJykL6FA18DErvQiJQ= +github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1/go.mod h1:l2Tm4N2DKuq3ljONC2vOATeM9PUpXbIc8SgXdwwqEto= diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/shim.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/shim.go new file mode 100644 index 0000000000..782d87a636 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/shim.go @@ -0,0 +1,52 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package WrappedSimpleOrphanedService + +import ( + "context" + + "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygenerated" +) + +type Shim struct { + SimpleOrphanedTypes.ISimpleOrphanedClient + client *simpleorphanedsmithygenerated.Client +} + +func (_static *CompanionStruct_Default___) WrappedSimpleOrphaned(inputConfig SimpleOrphanedTypes.SimpleOrphanedConfig) Wrappers.Result { + var nativeConfig = simpleorphanedsmithygenerated.SimpleOrphanedConfig_FromDafny(inputConfig) + var nativeClient, nativeError = simpleorphanedsmithygenerated.NewClient(nativeConfig) + if nativeError != nil { + return Wrappers.Companion_Result_.Create_Failure_(SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeError)) + } + return Wrappers.Companion_Result_.Create_Success_(&Shim{client: nativeClient}) +} + +func (shim *Shim) CreateOrphanedStructure(input SimpleOrphanedTypes.CreateOrphanedStructureInput) Wrappers.Result { + var native_request = simpleorphanedsmithygenerated.CreateOrphanedStructureInput_FromDafny(input) + var native_response, native_error = shim.client.CreateOrphanedStructure(context.Background(), native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedStructureOutput_ToDafny(*native_response)) +} + +func (shim *Shim) CreateOrphanedResource(input SimpleOrphanedTypes.CreateOrphanedResourceInput) Wrappers.Result { + var native_request = simpleorphanedsmithygenerated.CreateOrphanedResourceInput_FromDafny(input) + var native_response, native_error = shim.client.CreateOrphanedResource(context.Background(), native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedResourceOutput_ToDafny(*native_response)) +} + +func (shim *Shim) CreateOrphanedError(input SimpleOrphanedTypes.CreateOrphanedErrorInput) Wrappers.Result { + var native_request = simpleorphanedsmithygenerated.CreateOrphanedErrorInput_FromDafny(input) + var native_response, native_error = shim.client.CreateOrphanedError(context.Background(), native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedErrorOutput_ToDafny(*native_response)) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go new file mode 100644 index 0000000000..9418326060 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go @@ -0,0 +1,25 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +type OrphanedResource struct { + Impl SimpleOrphanedTypes.IOrphanedResource +} + +func (this *OrphanedResource) OrphanedResourceOperation(params simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput) (*simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput, error) { + var dafny_request SimpleOrphanedTypes.OrphanedResourceOperationInput = OrphanedResourceOperationInput_ToDafny(params) + var dafny_response = this.Impl.OrphanedResourceOperation(dafny_request) + + if dafny_response.Is_Failure() { + err := dafny_response.Dtor_error().(SimpleOrphanedTypes.Error) + return nil, Error_FromDafny(err) + } + var native_response = OrphanedResourceOperationOutput_FromDafny(dafny_response.Dtor_value().(SimpleOrphanedTypes.OrphanedResourceOperationOutput)) + return &native_response, nil + +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go new file mode 100644 index 0000000000..98fdb52ec9 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go @@ -0,0 +1,23 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +type OrphanedResourceNativeWrapper struct { + SimpleOrphanedTypes.IOrphanedResource + Impl simpleorphanedsmithygeneratedtypes.IOrphanedResource +} + +func (this *OrphanedResourceNativeWrapper) OrphanedResourceOperation(input SimpleOrphanedTypes.OrphanedResourceOperationInput) Wrappers.Result { + var native_request = OrphanedResourceOperationInput_FromDafny(input) + var native_response, native_error = this.Impl.OrphanedResourceOperation(native_request) + if native_error != nil { + return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) + } + return Wrappers.Companion_Result_.Create_Success_(OrphanedResourceOperationOutput_ToDafny(*native_response)) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/api_client.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/api_client.go new file mode 100644 index 0000000000..f40b82ca89 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/api_client.go @@ -0,0 +1,24 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +type Client struct { + DafnyClient SimpleOrphanedTypes.ISimpleOrphanedClient +} + +func NewClient(clientConfig simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig) (*Client, error) { + var dafnyConfig = SimpleOrphanedConfig_ToDafny(clientConfig) + var dafny_response = SimpleOrphaned.Companion_Default___.SimpleOrphaned(dafnyConfig) + if dafny_response.Is_Failure() { + panic("Client construction failed. This should never happen") + } + var dafnyClient = dafny_response.Extract().(SimpleOrphanedTypes.ISimpleOrphanedClient) + client := &Client{dafnyClient} + return client, nil +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go new file mode 100644 index 0000000000..52358df9e6 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go @@ -0,0 +1,128 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +func OrphanedResourceOperationInput_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput) SimpleOrphanedTypes.OrphanedResourceOperationInput { + + return func() SimpleOrphanedTypes.OrphanedResourceOperationInput { + + return SimpleOrphanedTypes.Companion_OrphanedResourceOperationInput_.Create_OrphanedResourceOperationInput_(simple_orphaned_OrphanedResourceOperationInput_someString_ToDafny(nativeInput.SomeString)) + }() + +} + +func OrphanedResourceOperationOutput_ToDafny(nativeOutput simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput) SimpleOrphanedTypes.OrphanedResourceOperationOutput { + + return func() SimpleOrphanedTypes.OrphanedResourceOperationOutput { + + return SimpleOrphanedTypes.Companion_OrphanedResourceOperationOutput_.Create_OrphanedResourceOperationOutput_(simple_orphaned_OrphanedResourceOperationOutput_someString_ToDafny(nativeOutput.SomeString)) + }() + +} + +func OrphanedResource_ToDafny(nativeResource simpleorphanedsmithygeneratedtypes.IOrphanedResource) SimpleOrphanedTypes.IOrphanedResource { + val, ok := nativeResource.(*OrphanedResource) + if ok { + return val.Impl + } + return OrphanedResource{&OrphanedResourceNativeWrapper{Impl: nativeResource}}.Impl + +} + +func OrphanedError_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OrphanedError) SimpleOrphanedTypes.Error { + return func() SimpleOrphanedTypes.Error { + + return SimpleOrphanedTypes.Companion_Error_.Create_OrphanedError_(simple_orphaned_OrphanedError_message_ToDafny(nativeInput.Message)) + }() + +} + +func CollectionOfErrors_Input_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.CollectionOfErrors) SimpleOrphanedTypes.Error { + var e []interface{} + for _, i2 := range nativeInput.ListOfErrors { + e = append(e, Error_ToDafny(i2)) + } + return SimpleOrphanedTypes.Companion_Error_.Create_CollectionOfErrors_(dafny.SeqOf(e...), dafny.SeqOfChars([]dafny.Char(nativeInput.Message)...)) +} +func OpaqueError_Input_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OpaqueError) SimpleOrphanedTypes.Error { + return SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeInput.ErrObject) +} + +func Error_ToDafny(err error) SimpleOrphanedTypes.Error { + switch err.(type) { + // Service Errors + case simpleorphanedsmithygeneratedtypes.OrphanedError: + return OrphanedError_ToDafny(err.(simpleorphanedsmithygeneratedtypes.OrphanedError)) + + //DependentErrors + + //Unmodelled Errors + case simpleorphanedsmithygeneratedtypes.CollectionOfErrors: + return CollectionOfErrors_Input_ToDafny(err.(simpleorphanedsmithygeneratedtypes.CollectionOfErrors)) + + default: + error, ok := err.(simpleorphanedsmithygeneratedtypes.OpaqueError) + if !ok { + panic("Error is not an OpaqueError") + } + return OpaqueError_Input_ToDafny(error) + } +} + +func SimpleOrphanedConfig_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig) SimpleOrphanedTypes.SimpleOrphanedConfig { + return func() SimpleOrphanedTypes.SimpleOrphanedConfig { + + return SimpleOrphanedTypes.Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(simple_orphaned_SimpleOrphanedConfig_structureMember_ToDafny(nativeInput.StructureMember)) + }() + +} + +func simple_orphaned_SimpleOrphanedConfig_structureMember_ToDafny(input *simpleorphanedsmithygeneratedtypes.OrphanedConfigShape) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(SimpleOrphanedTypes.Companion_OrphanedConfigShape_.Create_OrphanedConfigShape_(simple_orphaned_OrphanedConfigShape_stringMember_ToDafny(input.StringMember))) + }() +} + +func simple_orphaned_OrphanedError_message_ToDafny(input string) dafny.Sequence { + return func() dafny.Sequence { + + return dafny.SeqOfChars([]dafny.Char(input)...) + }() +} + +func simple_orphaned_OrphanedConfigShape_stringMember_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func simple_orphaned_OrphanedResourceOperationInput_someString_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} + +func simple_orphaned_OrphanedResourceOperationOutput_someString_ToDafny(input *string) Wrappers.Option { + return func() Wrappers.Option { + if input == nil { + return Wrappers.Companion_Option_.Create_None_() + } + return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) + }() +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_native.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_native.go new file mode 100644 index 0000000000..2a951e89ca --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_native.go @@ -0,0 +1,156 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygenerated + +import ( + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" + "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" +) + +func OrphanedResourceOperationInput_FromDafny(dafnyInput SimpleOrphanedTypes.OrphanedResourceOperationInput) simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput { + + return simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput{SomeString: simple_orphaned_OrphanedResourceOperationInput_someString_FromDafny(dafnyInput.Dtor_someString().UnwrapOr(nil))} + +} + +func OrphanedResourceOperationOutput_FromDafny(dafnyOutput SimpleOrphanedTypes.OrphanedResourceOperationOutput) simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput { + + return simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput{SomeString: simple_orphaned_OrphanedResourceOperationOutput_someString_FromDafny(dafnyOutput.Dtor_someString().UnwrapOr(nil))} + +} + +func OrphanedResource_FromDafny(dafnyResource SimpleOrphanedTypes.IOrphanedResource) simpleorphanedsmithygeneratedtypes.IOrphanedResource { + val, ok := dafnyResource.(*OrphanedResourceNativeWrapper) + if ok { + return val.Impl + } + + return &OrphanedResource{dafnyResource} +} + +func OrphanedError_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.OrphanedError { + return simpleorphanedsmithygeneratedtypes.OrphanedError{Message: simple_orphaned_OrphanedError_message_FromDafny(dafnyOutput.Dtor_message())} + +} + +func CollectionOfErrors_Output_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.CollectionOfErrors { + listOfErrors := dafnyOutput.Dtor_list() + message := dafnyOutput.Dtor_message() + t := simpleorphanedsmithygeneratedtypes.CollectionOfErrors{} + for i := dafny.Iterate(listOfErrors); ; { + val, ok := i() + if !ok { + break + } + err := val.(SimpleOrphanedTypes.Error) + t.ListOfErrors = append(t.ListOfErrors, Error_FromDafny(err)) + + } + t.Message = func() string { + var s string + for i := dafny.Iterate(message); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() + return t +} +func OpaqueError_Output_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.OpaqueError { + return simpleorphanedsmithygeneratedtypes.OpaqueError{ + ErrObject: dafnyOutput.Dtor_obj(), + } +} + +func Error_FromDafny(err SimpleOrphanedTypes.Error) error { + // Service Errors + if err.Is_OrphanedError() { + return OrphanedError_FromDafny(err) + } + + //DependentErrors + + //Unmodelled Errors + if err.Is_CollectionOfErrors() { + return CollectionOfErrors_Output_FromDafny(err) + } + + return OpaqueError_Output_FromDafny(err) +} + +func SimpleOrphanedConfig_FromDafny(dafnyOutput SimpleOrphanedTypes.SimpleOrphanedConfig) simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig { + return simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig{StructureMember: simple_orphaned_SimpleOrphanedConfig_structureMember_FromDafny(dafnyOutput.Dtor_structureMember().UnwrapOr(nil))} + +} + +func simple_orphaned_SimpleOrphanedConfig_structureMember_FromDafny(input interface{}) *simpleorphanedsmithygeneratedtypes.OrphanedConfigShape { + if input == nil { + return nil + } + return &simpleorphanedsmithygeneratedtypes.OrphanedConfigShape{StringMember: simple_orphaned_OrphanedConfigShape_stringMember_FromDafny(input.(SimpleOrphanedTypes.OrphanedConfigShape).Dtor_stringMember().UnwrapOr(nil))} +} +func simple_orphaned_OrphanedError_message_FromDafny(input interface{}) string { + return func() string { + var s string + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return s + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func simple_orphaned_OrphanedConfigShape_stringMember_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func simple_orphaned_OrphanedResourceOperationInput_someString_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} +func simple_orphaned_OrphanedResourceOperationOutput_someString_FromDafny(input interface{}) *string { + return func() *string { + var s string + if input == nil { + return nil + } + for i := dafny.Iterate(input); ; { + val, ok := i() + if !ok { + return &[]string{s}[0] + } else { + s = s + string(val.(dafny.Char)) + } + } + }() +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go new file mode 100644 index 0000000000..b2f3fea8f5 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go @@ -0,0 +1,19 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygeneratedtypes + +type OrphanedV1Enum string + +const ( + OrphanedV1EnumFirst OrphanedV1Enum = "0x0014" + OrphanedV1EnumSecond OrphanedV1Enum = "0x0046" + OrphanedV1EnumThird OrphanedV1Enum = "0x0078" +) + +func (OrphanedV1Enum) Values() []OrphanedV1Enum { + return []OrphanedV1Enum{ + "0x0014", + "0x0046", + "0x0078", + } +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go new file mode 100644 index 0000000000..7db66d4f95 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go @@ -0,0 +1,17 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygeneratedtypes + +import ( + "fmt" +) + +type OrphanedError struct { + SimpleOrphanedBaseException + Message string + ErrorCodeOverride *string +} + +func (e OrphanedError) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go new file mode 100644 index 0000000000..5fb450e2aa --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go @@ -0,0 +1,177 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygeneratedtypes + +import ( + "fmt" +) + +type CreateOrphanedErrorInput struct { +} + +func (input CreateOrphanedErrorInput) Validate() error { + + return nil +} + +type CreateOrphanedErrorOutput struct { +} + +func (input CreateOrphanedErrorOutput) Validate() error { + + return nil +} + +type CreateOrphanedResourceInput struct { +} + +func (input CreateOrphanedResourceInput) Validate() error { + + return nil +} + +type CreateOrphanedResourceOutput struct { +} + +func (input CreateOrphanedResourceOutput) Validate() error { + + return nil +} + +type CreateOrphanedStructureInput struct { +} + +func (input CreateOrphanedStructureInput) Validate() error { + + return nil +} + +type CreateOrphanedStructureOutput struct { +} + +func (input CreateOrphanedStructureOutput) Validate() error { + + return nil +} + +type OrphanedConfigShape struct { + StringMember *string +} + +func (input OrphanedConfigShape) Validate() error { + + return nil +} + +type OrphanedResourceOperationInput struct { + SomeString *string +} + +func (input OrphanedResourceOperationInput) Validate() error { + + return nil +} + +type OrphanedResourceOperationOutput struct { + SomeString *string +} + +func (input OrphanedResourceOperationOutput) Validate() error { + + return nil +} + +type OrphanedResourceReference struct { +} + +func (input OrphanedResourceReference) Validate() error { + + return nil +} + +type OrphanedStructure struct { + BlobValue []byte + + BooleanValue *bool + + EnumValue *OrphanedV1Enum + + IntegerValue *int32 + + ListValue []string + + LongValue *int64 + + MapValue map[string]string + + StringValue *string + + UnionValue OrphanedUnion +} + +func (input OrphanedStructure) Validate() error { + if input.simple_orphaned_OrphanedStructure_unionValue_Validate() != nil { + return input.simple_orphaned_OrphanedStructure_unionValue_Validate() + } + + return nil +} + +func (input OrphanedStructure) simple_orphaned_OrphanedStructure_unionValue_Validate() error { + if input.UnionValue == nil { + return nil + } + switch unionType := input.UnionValue.(type) { + case *OrphanedUnionMemberintegerValue: + case *OrphanedUnionMemberstringValue: + // Default case should not be reached. + default: + panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) + } + + return nil +} + +type SimpleOrphanedConfig struct { + StructureMember *OrphanedConfigShape +} + +func (input SimpleOrphanedConfig) Validate() error { + if input.StructureMember != nil { + if input.StructureMember.Validate() != nil { + return input.StructureMember.Validate() + } + + } + + return nil +} + +// OrphanedUnionMemberintegerValue +// OrphanedUnionMemberstringValue +type OrphanedUnion interface { + isOrphanedUnion() +} + +type OrphanedUnionMemberintegerValue struct { + Value int32 +} + +func (*OrphanedUnionMemberintegerValue) isOrphanedUnion() {} + +type OrphanedUnionMemberstringValue struct { + Value string +} + +func (*OrphanedUnionMemberstringValue) isOrphanedUnion() {} + +type SimpleOrphanedBaseException interface { + // This is a dummy method to allow type assertion since Go empty interfaces + // aren't useful for type assertion checks. No concrete class is expected to implement + // this method. This is also not exported. + interfaceBindingMethod() +} + +type IOrphanedResource interface { + OrphanedResourceOperation(OrphanedResourceOperationInput) (*OrphanedResourceOperationOutput, error) +} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go new file mode 100644 index 0000000000..982a370aff --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go @@ -0,0 +1,26 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package simpleorphanedsmithygeneratedtypes + +import ( + "fmt" +) + +type CollectionOfErrors struct { + SimpleOrphanedBaseException + ListOfErrors []error + Message string +} + +func (e CollectionOfErrors) Error() string { + return fmt.Sprintf("message: %s\n err %v", e.Message, e.ListOfErrors) +} + +type OpaqueError struct { + SimpleOrphanedBaseException + ErrObject interface{} +} + +func (e OpaqueError) Error() string { + return fmt.Sprintf("message: %v", e.ErrObject) +} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/client.rs b/TestModels/OrphanedShapes/runtimes/rust/src/client.rs deleted file mode 100644 index 40a2417d26..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/client.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -use aws_smithy_types::error::operation::BuildError; - -#[derive(::std::clone::Clone, ::std::fmt::Debug, ::std::cmp::PartialEq)] -#[allow(missing_docs)] -pub struct Client { - pub(crate) dafny_client: ::dafny_runtime::Object -} - -impl Client { - /// Creates a new client from the service [`Config`](crate::Config). - #[track_caller] - pub fn from_conf( - conf: crate::types::simple_orphaned_config::SimpleOrphanedConfig, - ) -> Result { - let inner = - crate::simple::orphaned::internaldafny::_default::SimpleOrphaned( - &crate::conversions::simple_orphaned_config::_simple_orphaned_config::to_dafny(conf), - ); - if matches!( - inner.as_ref(), - crate::_Wrappers_Compile::Result::Failure { .. } - ) { - return Err(crate::conversions::error::from_dafny(inner.as_ref().error().clone())); - } - Ok(Self { - dafny_client: ::dafny_runtime::upcast_object()(inner.Extract()) - }) - } -} - -mod create_orphaned_structure; - -mod create_orphaned_resource; - -mod create_orphaned_error; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_error.rs deleted file mode 100644 index 0ecd2537f5..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_error.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -impl crate::client::Client { - /// Constructs a fluent builder for the [`CreateOrphanedError`](crate::operation::create_orphaned_error::builders::CreateOrphanedErrorFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - - /// - On success, responds with [`CreateOrphanedErrorOutput`](crate::operation::create_orphaned_error::CreateOrphanedErrorOutput) with field(s): - - /// - On failure, responds with [`SdkError`](crate::operation::create_orphaned_error::CreateOrphanedErrorError) - pub fn create_orphaned_error(&self) -> crate::operation::create_orphaned_error::builders::CreateOrphanedErrorFluentBuilder { - crate::operation::create_orphaned_error::builders::CreateOrphanedErrorFluentBuilder::new(self.clone()) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_resource.rs deleted file mode 100644 index 9876da1e1f..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_resource.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -impl crate::client::Client { - /// Constructs a fluent builder for the [`CreateOrphanedResource`](crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - - /// - On success, responds with [`CreateOrphanedResourceOutput`](crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput) with field(s): - - /// - On failure, responds with [`SdkError`](crate::operation::create_orphaned_resource::CreateOrphanedResourceError) - pub fn create_orphaned_resource(&self) -> crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceFluentBuilder { - crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceFluentBuilder::new(self.clone()) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_structure.rs deleted file mode 100644 index a6bf6ac2c7..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/client/create_orphaned_structure.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -impl crate::client::Client { - /// Constructs a fluent builder for the [`CreateOrphanedStructure`](crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - - /// - On success, responds with [`CreateOrphanedStructureOutput`](crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput) with field(s): - - /// - On failure, responds with [`SdkError`](crate::operation::create_orphaned_structure::CreateOrphanedStructureError) - pub fn create_orphaned_structure(&self) -> crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureFluentBuilder { - crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureFluentBuilder::new(self.clone()) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions.rs deleted file mode 100644 index be8fdf0fc9..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod client; - - pub mod create_orphaned_error; - - pub mod create_orphaned_error_input; - - pub mod create_orphaned_error_output; - - pub mod create_orphaned_resource; - - pub mod create_orphaned_resource_input; - - pub mod create_orphaned_resource_output; - - pub mod create_orphaned_structure; - - pub mod create_orphaned_structure_input; - - pub mod create_orphaned_structure_output; - - pub mod error; - - pub mod orphaned_config_shape; - - pub mod orphaned_resource; - - pub mod orphaned_resource_operation; - - pub mod orphaned_resource_operation_input; - - pub mod orphaned_resource_operation_output; - - pub mod orphaned_structure; - - pub mod orphaned_union; - - pub mod orphaned_v1_enum; - -pub mod simple_orphaned_config; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/client.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/client.rs deleted file mode 100644 index 513bf744c2..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/client.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: &crate::client::Client, -) -> - ::dafny_runtime::Object -{ - value.dafny_client.clone() -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::dafny_runtime::Object< - dyn crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient - >, -) -> crate::client::Client { - crate::client::Client { dafny_client: dafny_value } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error.rs deleted file mode 100644 index ddde98d7c6..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error.rs +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. - - pub mod _create_orphaned_error_input; - - pub mod _create_orphaned_error_output; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_input.rs deleted file mode 100644 index cd272b4bd8..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_input.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::create_orphaned_error::CreateOrphanedErrorInput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, ->{ - ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput::CreateOrphanedErrorInput { - - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, - >, -) -> crate::operation::create_orphaned_error::CreateOrphanedErrorInput { - crate::operation::create_orphaned_error::CreateOrphanedErrorInput::builder() - - .build() - .unwrap() -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_output.rs deleted file mode 100644 index 9bd9cc52e4..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error/_create_orphaned_error_output.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, ->{ - ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput::CreateOrphanedErrorOutput { - - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, - >, -) -> crate::operation::create_orphaned_error::CreateOrphanedErrorOutput { - crate::operation::create_orphaned_error::CreateOrphanedErrorOutput::builder() - - .build() - .unwrap() -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_input.rs deleted file mode 100644 index b9b58f85f6..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_input.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::CreateOrphanedErrorInput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::CreateOrphanedErrorInput, -) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput::CreateOrphanedErrorInput { - - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, - >, -) -> crate::types::CreateOrphanedErrorInput { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput, -) -> crate::types::CreateOrphanedErrorInput { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorInput::CreateOrphanedErrorInput {..} => - crate::types::CreateOrphanedErrorInput::builder() - - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_output.rs deleted file mode 100644 index 1907c7d6bc..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_error_output.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::CreateOrphanedErrorOutput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::CreateOrphanedErrorOutput, -) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput::CreateOrphanedErrorOutput { - - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, - >, -) -> crate::types::CreateOrphanedErrorOutput { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput, -) -> crate::types::CreateOrphanedErrorOutput { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedErrorOutput::CreateOrphanedErrorOutput {..} => - crate::types::CreateOrphanedErrorOutput::builder() - - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource.rs deleted file mode 100644 index 58684780b4..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource.rs +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. - - pub mod _create_orphaned_resource_input; - - pub mod _create_orphaned_resource_output; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_input.rs deleted file mode 100644 index a83c094be3..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_input.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::create_orphaned_resource::CreateOrphanedResourceInput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, ->{ - ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput::CreateOrphanedResourceInput { - - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, - >, -) -> crate::operation::create_orphaned_resource::CreateOrphanedResourceInput { - crate::operation::create_orphaned_resource::CreateOrphanedResourceInput::builder() - - .build() - .unwrap() -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_output.rs deleted file mode 100644 index 5dd75dd331..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource/_create_orphaned_resource_output.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, ->{ - ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput::CreateOrphanedResourceOutput { - - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, - >, -) -> crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput { - crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput::builder() - - .build() - .unwrap() -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_input.rs deleted file mode 100644 index 98cf0ff360..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_input.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::CreateOrphanedResourceInput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::CreateOrphanedResourceInput, -) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput::CreateOrphanedResourceInput { - - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, - >, -) -> crate::types::CreateOrphanedResourceInput { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput, -) -> crate::types::CreateOrphanedResourceInput { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceInput::CreateOrphanedResourceInput {..} => - crate::types::CreateOrphanedResourceInput::builder() - - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_output.rs deleted file mode 100644 index 87c8b7dfac..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_resource_output.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::CreateOrphanedResourceOutput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::CreateOrphanedResourceOutput, -) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput::CreateOrphanedResourceOutput { - - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, - >, -) -> crate::types::CreateOrphanedResourceOutput { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput, -) -> crate::types::CreateOrphanedResourceOutput { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedResourceOutput::CreateOrphanedResourceOutput {..} => - crate::types::CreateOrphanedResourceOutput::builder() - - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure.rs deleted file mode 100644 index 578ae4695c..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure.rs +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. - - pub mod _create_orphaned_structure_input; - - pub mod _create_orphaned_structure_output; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_input.rs deleted file mode 100644 index 1a6cb24bd7..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_input.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::create_orphaned_structure::CreateOrphanedStructureInput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, ->{ - ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput::CreateOrphanedStructureInput { - - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, - >, -) -> crate::operation::create_orphaned_structure::CreateOrphanedStructureInput { - crate::operation::create_orphaned_structure::CreateOrphanedStructureInput::builder() - - .build() - .unwrap() -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_output.rs deleted file mode 100644 index cd61f8a368..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure/_create_orphaned_structure_output.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, ->{ - ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput::CreateOrphanedStructureOutput { - - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, - >, -) -> crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput { - crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput::builder() - - .build() - .unwrap() -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_input.rs deleted file mode 100644 index 8431526c70..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_input.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::CreateOrphanedStructureInput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::CreateOrphanedStructureInput, -) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput::CreateOrphanedStructureInput { - - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, - >, -) -> crate::types::CreateOrphanedStructureInput { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput, -) -> crate::types::CreateOrphanedStructureInput { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureInput::CreateOrphanedStructureInput {..} => - crate::types::CreateOrphanedStructureInput::builder() - - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_output.rs deleted file mode 100644 index 6184784382..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/create_orphaned_structure_output.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::CreateOrphanedStructureOutput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::CreateOrphanedStructureOutput, -) -> crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput::CreateOrphanedStructureOutput { - - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, - >, -) -> crate::types::CreateOrphanedStructureOutput { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput, -) -> crate::types::CreateOrphanedStructureOutput { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::CreateOrphanedStructureOutput::CreateOrphanedStructureOutput {..} => - crate::types::CreateOrphanedStructureOutput::builder() - - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/error.rs deleted file mode 100644 index 2461c87937..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/error.rs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Wraps up an arbitrary Rust Error value as a Dafny Error -pub fn to_opaque_error(value: String) -> - ::std::rc::Rc -{ - let error_msg = value.clone(); - let error_msg = ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&error_msg); - let error_obj: ::dafny_runtime::Object = ::dafny_runtime::Object(Some( - ::std::rc::Rc::new(::std::cell::UnsafeCell::new(value)), - )); - ::std::rc::Rc::new( - crate::r#simple::orphaned::internaldafny::types::Error::OpaqueWithText { - obj: error_obj, - objMessage: error_msg - }, - ) -} - -/// Wraps up an arbitrary Rust Error value as a Dafny Result.Failure -pub fn to_opaque_error_result(value: String) -> - ::std::rc::Rc< - crate::_Wrappers_Compile::Result< - T, - ::std::rc::Rc - > - > -{ - ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { - error: to_opaque_error(value), - }) -} -pub fn to_dafny( - value: crate::types::error::Error, -) -> ::std::rc::Rc { - ::std::rc::Rc::new(match value { - crate::types::error::Error::OrphanedError { message } => - crate::r#simple::orphaned::internaldafny::types::Error::OrphanedError { - message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&message), - }, - crate::types::error::Error::CollectionOfErrors { list, message } => - crate::r#simple::orphaned::internaldafny::types::Error::CollectionOfErrors { - message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&message), - list: ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&list, |e| to_dafny(e.clone())) - }, - crate::types::error::Error::ValidationError(inner) => - crate::r#simple::orphaned::internaldafny::types::Error::Opaque { - obj: { - let rc = ::std::rc::Rc::new(inner) as ::std::rc::Rc; - // safety: `rc` is new, ensuring it has refcount 1 and is uniquely owned. - // we should use `dafny_runtime_conversions::rc_struct_to_dafny_class` once it - // accepts unsized types (https://github.com/dafny-lang/dafny/pull/5769) - unsafe { ::dafny_runtime::Object::from_rc(rc) } - }, - }, - crate::types::error::Error::Opaque { obj } => - crate::r#simple::orphaned::internaldafny::types::Error::Opaque { - obj: ::dafny_runtime::Object(obj.0) - }, - crate::types::error::Error::OpaqueWithText { obj, objMessage } => - crate::r#simple::orphaned::internaldafny::types::Error::OpaqueWithText { - obj: ::dafny_runtime::Object(obj.0), - objMessage: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&objMessage), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::Error, - >, -) -> crate::types::error::Error { - match ::std::borrow::Borrow::borrow(&dafny_value) { - crate::r#simple::orphaned::internaldafny::types::Error::OrphanedError { message } => - crate::types::error::Error::OrphanedError { - message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&message), - }, - crate::r#simple::orphaned::internaldafny::types::Error::CollectionOfErrors { list, message } => - crate::types::error::Error::CollectionOfErrors { - message: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&message), - list: ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(&list, |e| from_dafny(e.clone())) - }, - crate::r#simple::orphaned::internaldafny::types::Error::Opaque { obj } => - crate::types::error::Error::Opaque { - obj: obj.clone() - }, - crate::r#simple::orphaned::internaldafny::types::Error::Opaque { obj } => - { - use ::std::any::Any; - if ::dafny_runtime::is_object!(obj, crate::types::error::ValidationError) { - let typed = ::dafny_runtime::cast_object!(obj.clone(), crate::types::error::ValidationError); - crate::types::error::Error::ValidationError( - // safety: dafny_class_to_struct will increment ValidationError's Rc - unsafe { - ::dafny_runtime::dafny_runtime_conversions::object::dafny_class_to_struct(typed) - } - ) - } else { - crate::types::error::Error::Opaque { - obj: obj.clone() - } - } - }, - crate::r#simple::orphaned::internaldafny::types::Error::OpaqueWithText { obj, objMessage } => - { - use ::std::any::Any; - if ::dafny_runtime::is_object!(obj, crate::types::error::ValidationError) { - let typed = ::dafny_runtime::cast_object!(obj.clone(), crate::types::error::ValidationError); - crate::types::error::Error::ValidationError( - // safety: dafny_class_to_struct will increment ValidationError's Rc - unsafe { - ::dafny_runtime::dafny_runtime_conversions::object::dafny_class_to_struct(typed) - } - ) - } else { - crate::types::error::Error::OpaqueWithText { - obj: obj.clone(), - objMessage: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(&objMessage), - } - } - }, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_config_shape.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_config_shape.rs deleted file mode 100644 index 2e598d4fe9..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_config_shape.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::OrphanedConfigShape, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::OrphanedConfigShape, -) -> crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape { - crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape::OrphanedConfigShape { - stringMember: crate::standard_library_conversions::ostring_to_dafny(&value.string_member), - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape, - >, -) -> crate::types::OrphanedConfigShape { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape, -) -> crate::types::OrphanedConfigShape { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::OrphanedConfigShape::OrphanedConfigShape {..} => - crate::types::OrphanedConfigShape::builder() - .set_string_member(crate::standard_library_conversions::ostring_from_dafny(dafny_value.stringMember().clone())) - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource.rs deleted file mode 100644 index bb01660838..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource.rs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::orphaned_resource::OrphanedResourceRef, -) -> ::dafny_runtime::Object< - dyn crate::r#simple::orphaned::internaldafny::types::IOrphanedResource, -> { - let wrap = OrphanedResourceWrapper { - obj: value.clone(), - }; - let inner = ::std::rc::Rc::new(::std::cell::UnsafeCell::new(wrap)); - ::dafny_runtime::Object (Some(inner) ) -} - -pub struct OrphanedResourceWrapper { - obj: crate::types::orphaned_resource::OrphanedResourceRef, -} - -impl ::dafny_runtime::UpcastObject for OrphanedResourceWrapper { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::dafny_runtime::Object< - dyn crate::r#simple::orphaned::internaldafny::types::IOrphanedResource, - >, -) -> crate::types::orphaned_resource::OrphanedResourceRef { - let wrap = IOrphanedResourceDafnyWrapper { - obj: dafny_value.clone(), - }; - crate::types::orphaned_resource::OrphanedResourceRef { - inner: ::std::rc::Rc::new(::std::cell::RefCell::new(wrap)) - } -} - -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -pub struct IOrphanedResourceDafnyWrapper { - pub(crate) obj: ::dafny_runtime::Object< - dyn crate::r#simple::orphaned::internaldafny::types::IOrphanedResource, - >, -} - -impl crate::simple::orphaned::internaldafny::types::IOrphanedResource - for OrphanedResourceWrapper -{ - fn r#_OrphanedResourceOperation_k( - &self, - input: &::std::rc::Rc, -) -> ::std::rc::Rc< - crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc, - ::std::rc::Rc, - >, -> -{ - let inner_input = crate::conversions::orphaned_resource_operation::_orphaned_resource_operation_input::from_dafny(input.clone()); - let inner_result = self.obj.inner.borrow_mut().orphaned_resource_operation(inner_input); - let result = match inner_result { - Ok(x) => crate::r#_Wrappers_Compile::Result::Success { - value: crate::conversions::orphaned_resource_operation::_orphaned_resource_operation_output::to_dafny(x.clone()), - }, - Err(x) => crate::r#_Wrappers_Compile::Result::Failure { - error: crate::conversions::error::to_dafny(x), - }, - }; - ::std::rc::Rc::new(result) -} -} - -impl crate::types::orphaned_resource::OrphanedResource for IOrphanedResourceDafnyWrapper -{ - fn orphaned_resource_operation( - &self, - input: crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, -) -> Result< - crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, - crate::types::error::Error, -> { - let inner_input = crate::conversions::orphaned_resource_operation::_orphaned_resource_operation_input::to_dafny(input); - let inner_result = ::dafny_runtime::md!(self.obj.clone()).OrphanedResourceOperation(&inner_input); - if matches!( - inner_result.as_ref(), - crate::r#_Wrappers_Compile::Result::Success { .. } - ) { - Ok( - crate::conversions::orphaned_resource_operation::_orphaned_resource_operation_output::from_dafny(inner_result.value().clone()), - ) - } else { - Err(crate::conversions::error::from_dafny( - inner_result.error().clone(), - )) - } -} -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation.rs deleted file mode 100644 index 1ba99a12ab..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation.rs +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. - - pub mod _orphaned_resource_operation_input; - - pub mod _orphaned_resource_operation_output; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_input.rs deleted file mode 100644 index d6f3b6eae6..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_input.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, ->{ - ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput::OrphanedResourceOperationInput { - someString: crate::standard_library_conversions::ostring_to_dafny(&value.some_string), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, - >, -) -> crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput { - crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput::builder() - .set_some_string(crate::standard_library_conversions::ostring_from_dafny(dafny_value.someString().clone())) - .build() - .unwrap() -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_output.rs deleted file mode 100644 index 9813cb2894..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation/_orphaned_resource_operation_output.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, ->{ - ::std::rc::Rc::new(crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput::OrphanedResourceOperationOutput { - someString: crate::standard_library_conversions::ostring_to_dafny(&value.some_string), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, - >, -) -> crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput { - crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput::builder() - .set_some_string(crate::standard_library_conversions::ostring_from_dafny(dafny_value.someString().clone())) - .build() - .unwrap() -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_input.rs deleted file mode 100644 index 72c49a9938..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_input.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::OrphanedResourceOperationInput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::OrphanedResourceOperationInput, -) -> crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput { - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput::OrphanedResourceOperationInput { - someString: crate::standard_library_conversions::ostring_to_dafny(&value.some_string), - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, - >, -) -> crate::types::OrphanedResourceOperationInput { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput, -) -> crate::types::OrphanedResourceOperationInput { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationInput::OrphanedResourceOperationInput {..} => - crate::types::OrphanedResourceOperationInput::builder() - .set_some_string(crate::standard_library_conversions::ostring_from_dafny(dafny_value.someString().clone())) - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_output.rs deleted file mode 100644 index eb02ad6a7b..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_resource_operation_output.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::OrphanedResourceOperationOutput, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::OrphanedResourceOperationOutput, -) -> crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput { - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput::OrphanedResourceOperationOutput { - someString: crate::standard_library_conversions::ostring_to_dafny(&value.some_string), - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, - >, -) -> crate::types::OrphanedResourceOperationOutput { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput, -) -> crate::types::OrphanedResourceOperationOutput { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::OrphanedResourceOperationOutput::OrphanedResourceOperationOutput {..} => - crate::types::OrphanedResourceOperationOutput::builder() - .set_some_string(crate::standard_library_conversions::ostring_from_dafny(dafny_value.someString().clone())) - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_structure.rs deleted file mode 100644 index 8b4751fd40..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_structure.rs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::OrphanedStructure, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedStructure, -> { - ::std::rc::Rc::new(to_dafny_plain(value.clone())) -} - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::OrphanedStructure, -) -> crate::r#simple::orphaned::internaldafny::types::OrphanedStructure { - crate::r#simple::orphaned::internaldafny::types::OrphanedStructure::OrphanedStructure { - blobValue: crate::standard_library_conversions::oblob_to_dafny(&value.blob_value), - booleanValue: crate::standard_library_conversions::obool_to_dafny(&value.boolean_value), - stringValue: crate::standard_library_conversions::ostring_to_dafny(&value.string_value), - integerValue: crate::standard_library_conversions::oint_to_dafny(value.integer_value), - longValue: crate::standard_library_conversions::olong_to_dafny(&value.long_value), - unionValue: ::std::rc::Rc::new(match &value.union_value { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::orphaned_union::to_dafny(&x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - enumValue: ::std::rc::Rc::new(match &value.enum_value { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::orphaned_v1_enum::to_dafny(x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - mapValue: -::std::rc::Rc::new(match &value.map_value { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::hashmap_to_dafny_map(x, - |k| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&k), - |v| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&v), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - listValue: ::std::rc::Rc::new(match &value.list_value { - Some(x) => crate::r#_Wrappers_Compile::Option::Some { value : - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(x, - |e| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&e), - ) - }, - None => crate::r#_Wrappers_Compile::Option::None {} -}) -, - } -} - -#[allow(dead_code)] -pub fn option_to_dafny( - value: ::std::option::Option, -) -> ::std::rc::Rc>>{ - ::std::rc::Rc::new(match value { - ::std::option::Option::None => crate::_Wrappers_Compile::Option::None {}, - ::std::option::Option::Some(x) => crate::_Wrappers_Compile::Option::Some { - value: ::std::rc::Rc::new(to_dafny_plain(x)), - }, - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedStructure, - >, -) -> crate::types::OrphanedStructure { - plain_from_dafny(&*dafny_value) -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedStructure, -) -> crate::types::OrphanedStructure { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::OrphanedStructure::OrphanedStructure {..} => - crate::types::OrphanedStructure::builder() - .set_blob_value(crate::standard_library_conversions::oblob_from_dafny(dafny_value.blobValue().clone())) - .set_boolean_value(crate::standard_library_conversions::obool_from_dafny(dafny_value.booleanValue().clone())) - .set_string_value(crate::standard_library_conversions::ostring_from_dafny(dafny_value.stringValue().clone())) - .set_integer_value(crate::standard_library_conversions::oint_from_dafny(dafny_value.integerValue().clone())) - .set_long_value(crate::standard_library_conversions::olong_from_dafny(dafny_value.longValue().clone())) - .set_union_value(match (*dafny_value.unionValue()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::orphaned_union::from_dafny(value.clone())), - _ => None, -} -) - .set_enum_value(match &**dafny_value.enumValue() { - crate::r#_Wrappers_Compile::Option::Some { value } => Some( - crate::conversions::orphaned_v1_enum::from_dafny(value) - ), - _ => None, -} -) - .set_map_value(match (*dafny_value.mapValue()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_map_to_hashmap(value, - |k: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<::dafny_runtime::dafny_runtime_conversions::DafnyCharUTF16>| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(k), - |v: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<::dafny_runtime::dafny_runtime_conversions::DafnyCharUTF16>| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(v), - ) - ), - _ => None -} -) - .set_list_value(match (*dafny_value.listValue()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some( - ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(value, - |e: &::dafny_runtime::dafny_runtime_conversions::DafnySequence<::dafny_runtime::dafny_runtime_conversions::DafnyCharUTF16>| dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(e), - ) - ), - _ => None -} -) - .build() - .unwrap() - } -} - -#[allow(dead_code)] -pub fn option_from_dafny( - dafny_value: ::std::rc::Rc>>, -) -> ::std::option::Option { - match &*dafny_value { - crate::_Wrappers_Compile::Option::Some { value } => { - ::std::option::Option::Some(plain_from_dafny(value)) - } - _ => ::std::option::Option::None, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_union.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_union.rs deleted file mode 100644 index fdcdfaf4d0..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_union.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] -pub fn to_dafny( - value: &crate::types::OrphanedUnion, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedUnion, -> { - ::std::rc::Rc::new(match value { - crate::types::OrphanedUnion::IntegerValue(x) => - crate::r#simple::orphaned::internaldafny::types::OrphanedUnion::integerValue { - integerValue: x.clone(), - }, -crate::types::OrphanedUnion::StringValue(x) => - crate::r#simple::orphaned::internaldafny::types::OrphanedUnion::stringValue { - stringValue: dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&x), - }, - _ => panic!("Unknown union variant: {:?}", value), - }) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::OrphanedUnion, - >, -) -> crate::types::OrphanedUnion { - match &::std::rc::Rc::unwrap_or_clone(dafny_value) { - crate::r#simple::orphaned::internaldafny::types::OrphanedUnion::integerValue { - integerValue: x @ _, -} => crate::types::OrphanedUnion::IntegerValue(x .clone()), -crate::r#simple::orphaned::internaldafny::types::OrphanedUnion::stringValue { - stringValue: x @ _, -} => crate::types::OrphanedUnion::StringValue(dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(x)), - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_v1_enum.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_v1_enum.rs deleted file mode 100644 index 15f4394e93..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/orphaned_v1_enum.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: crate::types::OrphanedV1Enum, -) -> ::std::rc::Rc{ - ::std::rc::Rc::new(match value { - crate::types::OrphanedV1Enum::First => crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::FIRST {}, -crate::types::OrphanedV1Enum::Second => crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::SECOND {}, -crate::types::OrphanedV1Enum::Third => crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::THIRD {}, - _ => panic!("Unknown enum variant: {}", value), - }) -} - #[allow(dead_code)] -pub fn from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum, -) -> crate::types::OrphanedV1Enum { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::FIRST {} => crate::types::OrphanedV1Enum::First, -crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::SECOND {} => crate::types::OrphanedV1Enum::Second, -crate::r#simple::orphaned::internaldafny::types::OrphanedV1Enum::THIRD {} => crate::types::OrphanedV1Enum::Third, - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config.rs deleted file mode 100644 index ea2cf596ac..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config.rs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod _simple_orphaned_config; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config/_simple_orphaned_config.rs b/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config/_simple_orphaned_config.rs deleted file mode 100644 index 9fc2718339..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/conversions/simple_orphaned_config/_simple_orphaned_config.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[allow(dead_code)] - -pub fn to_dafny( - value: crate::types::simple_orphaned_config::SimpleOrphanedConfig, -) -> ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, -> { - ::std::rc::Rc::new(to_dafny_plain(value)) -} - -#[allow(dead_code)] -pub fn from_dafny( - dafny_value: ::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, - >, -) -> crate::types::simple_orphaned_config::SimpleOrphanedConfig { - plain_from_dafny(&*dafny_value) -} - - -#[allow(dead_code)] -pub fn to_dafny_plain( - value: crate::types::simple_orphaned_config::SimpleOrphanedConfig, -) -> crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig { - crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig::SimpleOrphanedConfig { - structureMember: ::std::rc::Rc::new(match &value.structure_member { - Some(x) => crate::_Wrappers_Compile::Option::Some { value: crate::conversions::orphaned_config_shape::to_dafny(&x.clone()) }, - None => crate::_Wrappers_Compile::Option::None { } -}) -, - } -} - -#[allow(dead_code)] -pub fn plain_from_dafny( - dafny_value: &crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, -) -> crate::types::simple_orphaned_config::SimpleOrphanedConfig { - match dafny_value { - crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig::SimpleOrphanedConfig {..} => - crate::types::simple_orphaned_config::SimpleOrphanedConfig::builder() - .set_structure_member(match (*dafny_value.structureMember()).as_ref() { - crate::r#_Wrappers_Compile::Option::Some { value } => - Some(crate::conversions::orphaned_config_shape::from_dafny(value.clone())), - _ => None, -} -) - .build() - .unwrap() - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/deps.rs b/TestModels/OrphanedShapes/runtimes/rust/src/deps.rs deleted file mode 100644 index 5fbbbaa0f8..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/deps.rs +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/error.rs deleted file mode 100644 index 4cddaa7c39..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/error.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use ::aws_smithy_runtime_api::box_error::BoxError; - -/// Error type returned by the client. -pub type SdkError = - ::aws_smithy_runtime_api::client::result::SdkError; -pub use ::aws_smithy_runtime_api::client::result::ConnectorError; -pub use ::aws_smithy_types::error::operation::BuildError; - -pub use ::aws_smithy_types::error::display::DisplayErrorContext; -pub use ::aws_smithy_types::error::metadata::ErrorMetadata; -pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; - -pub(crate) mod sealed_unhandled; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/error/sealed_unhandled.rs b/TestModels/OrphanedShapes/runtimes/rust/src/error/sealed_unhandled.rs deleted file mode 100644 index eae8007292..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/error/sealed_unhandled.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -use std::any::Any; - -use dafny_runtime::UpcastObject; - -/// This struct is not intended to be used. -/// -/// This struct holds information about an unhandled error, -/// but that information should be obtained by using the -/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait -/// on the error type. -/// -/// This struct intentionally doesn't yield any useful information itself. -#[deprecated( - note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ -variable wildcard pattern and check `.code()`: - \ -   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` - \ -See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error." -)] -#[derive(Debug)] -pub struct Unhandled { - pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, - pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, -} - -impl UpcastObject for Unhandled { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation.rs deleted file mode 100644 index d091a3fa4f..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Types for the `CreateOrphanedError` operation. -pub mod create_orphaned_error; - -/// Types for the `CreateOrphanedResource` operation. -pub mod create_orphaned_resource; - -/// Types for the `CreateOrphanedStructure` operation. -pub mod create_orphaned_structure; - -/// Types for the `OrphanedResourceOperation` operation. -pub mod orphaned_resource_operation; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error.rs deleted file mode 100644 index dd5e9a4feb..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Orchestration and serialization glue logic for `CreateOrphanedError`. -#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -#[non_exhaustive] -pub struct CreateOrphanedError; -impl CreateOrphanedError { - /// Creates a new `CreateOrphanedError` - pub fn new() -> Self { - Self - } - - pub(crate) async fn send( - client: &crate::client::Client, - input: crate::operation::create_orphaned_error::CreateOrphanedErrorInput, - ) -> ::std::result::Result< - crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, - crate::types::error::Error, - > { - - let inner_input = crate::conversions::create_orphaned_error::_create_orphaned_error_input::to_dafny(input); - let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).CreateOrphanedError(&inner_input); - if matches!( - inner_result.as_ref(), - crate::r#_Wrappers_Compile::Result::Success { .. } - ) { - Ok( - crate::conversions::create_orphaned_error::_create_orphaned_error_output::from_dafny(inner_result.value().clone()), - ) - } else { - Err(crate::conversions::error::from_dafny( - inner_result.error().clone(), - )) - } - } -} - -pub use crate::operation::create_orphaned_error::_create_orphaned_error_output::CreateOrphanedErrorOutput; - -pub use crate::operation::create_orphaned_error::_create_orphaned_error_input::CreateOrphanedErrorInput; - -pub(crate) mod _create_orphaned_error_output; - -pub(crate) mod _create_orphaned_error_input; - -/// Builders -pub mod builders; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_input.rs deleted file mode 100644 index 16d493e8ae..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_input.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedErrorInput { - -} -impl CreateOrphanedErrorInput { - -} -impl CreateOrphanedErrorInput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedErrorInput`](crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInput). - pub fn builder() -> crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInputBuilder { - crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedErrorInput`](crate::operation::operation::CreateOrphanedErrorInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedErrorInputBuilder { - -} -impl CreateOrphanedErrorInputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedErrorInput`](crate::operation::operation::CreateOrphanedErrorInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::create_orphaned_error::CreateOrphanedErrorInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::create_orphaned_error::CreateOrphanedErrorInput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_output.rs deleted file mode 100644 index 5b96b9a6bc..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/_create_orphaned_error_output.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedErrorOutput { - -} -impl CreateOrphanedErrorOutput { - -} -impl CreateOrphanedErrorOutput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedErrorOutput`](crate::operation::create_orphaned_error::builders::CreateOrphanedErrorOutput). - pub fn builder() -> crate::operation::create_orphaned_error::builders::CreateOrphanedErrorOutputBuilder { - crate::operation::create_orphaned_error::builders::CreateOrphanedErrorOutputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedErrorOutput`](crate::operation::operation::CreateOrphanedErrorOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedErrorOutputBuilder { - -} -impl CreateOrphanedErrorOutputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedErrorOutput`](crate::operation::operation::CreateOrphanedErrorOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::create_orphaned_error::CreateOrphanedErrorOutput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/builders.rs deleted file mode 100644 index 6fb150757d..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_error/builders.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use crate::operation::create_orphaned_error::_create_orphaned_error_output::CreateOrphanedErrorOutputBuilder; - -pub use crate::operation::create_orphaned_error::_create_orphaned_error_input::CreateOrphanedErrorInputBuilder; - -impl CreateOrphanedErrorInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - client: &crate::client::Client, - ) -> ::std::result::Result< - crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, - crate::types::error::Error, - > { - let mut fluent_builder = client.create_orphaned_error(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `CreateOrphanedError`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct CreateOrphanedErrorFluentBuilder { - client: crate::client::Client, - pub(crate) inner: crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInputBuilder, -} -impl CreateOrphanedErrorFluentBuilder { - /// Creates a new `CreateOrphanedError`. - pub(crate) fn new(client: crate::client::Client) -> Self { - Self { - client, - inner: ::std::default::Default::default(), - } - } - /// Access the CreateOrphanedError as a reference. - pub fn as_input(&self) -> &crate::operation::create_orphaned_error::builders::CreateOrphanedErrorInputBuilder { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::operation::create_orphaned_error::CreateOrphanedErrorOutput, - crate::types::error::Error, - > { - let input = self - .inner - .build() - // Using Opaque since we don't have a validation-specific error yet. - // Operations' models don't declare their own validation error, - // and smithy-rs seems to not generate a ValidationError case unless there is. - // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. - .map_err(|mut e| { - let msg = format!("{:?}", e); - crate::types::error::Error::OpaqueWithText { - obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any), - objMessage: msg - }})?; - crate::operation::create_orphaned_error::CreateOrphanedError::send(&self.client, input).await - } - - -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource.rs deleted file mode 100644 index 9d690b02dd..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Orchestration and serialization glue logic for `CreateOrphanedResource`. -#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -#[non_exhaustive] -pub struct CreateOrphanedResource; -impl CreateOrphanedResource { - /// Creates a new `CreateOrphanedResource` - pub fn new() -> Self { - Self - } - - pub(crate) async fn send( - client: &crate::client::Client, - input: crate::operation::create_orphaned_resource::CreateOrphanedResourceInput, - ) -> ::std::result::Result< - crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, - crate::types::error::Error, - > { - - let inner_input = crate::conversions::create_orphaned_resource::_create_orphaned_resource_input::to_dafny(input); - let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).CreateOrphanedResource(&inner_input); - if matches!( - inner_result.as_ref(), - crate::r#_Wrappers_Compile::Result::Success { .. } - ) { - Ok( - crate::conversions::create_orphaned_resource::_create_orphaned_resource_output::from_dafny(inner_result.value().clone()), - ) - } else { - Err(crate::conversions::error::from_dafny( - inner_result.error().clone(), - )) - } - } -} - -pub use crate::operation::create_orphaned_resource::_create_orphaned_resource_output::CreateOrphanedResourceOutput; - -pub use crate::operation::create_orphaned_resource::_create_orphaned_resource_input::CreateOrphanedResourceInput; - -pub(crate) mod _create_orphaned_resource_output; - -pub(crate) mod _create_orphaned_resource_input; - -/// Builders -pub mod builders; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_input.rs deleted file mode 100644 index 2d011ae0e7..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_input.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedResourceInput { - -} -impl CreateOrphanedResourceInput { - -} -impl CreateOrphanedResourceInput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedResourceInput`](crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInput). - pub fn builder() -> crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInputBuilder { - crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedResourceInput`](crate::operation::operation::CreateOrphanedResourceInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedResourceInputBuilder { - -} -impl CreateOrphanedResourceInputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedResourceInput`](crate::operation::operation::CreateOrphanedResourceInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::create_orphaned_resource::CreateOrphanedResourceInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::create_orphaned_resource::CreateOrphanedResourceInput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_output.rs deleted file mode 100644 index 5fe1e63483..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/_create_orphaned_resource_output.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedResourceOutput { - -} -impl CreateOrphanedResourceOutput { - -} -impl CreateOrphanedResourceOutput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedResourceOutput`](crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceOutput). - pub fn builder() -> crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceOutputBuilder { - crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceOutputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedResourceOutput`](crate::operation::operation::CreateOrphanedResourceOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedResourceOutputBuilder { - -} -impl CreateOrphanedResourceOutputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedResourceOutput`](crate::operation::operation::CreateOrphanedResourceOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/builders.rs deleted file mode 100644 index 474af09c1b..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_resource/builders.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use crate::operation::create_orphaned_resource::_create_orphaned_resource_output::CreateOrphanedResourceOutputBuilder; - -pub use crate::operation::create_orphaned_resource::_create_orphaned_resource_input::CreateOrphanedResourceInputBuilder; - -impl CreateOrphanedResourceInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - client: &crate::client::Client, - ) -> ::std::result::Result< - crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, - crate::types::error::Error, - > { - let mut fluent_builder = client.create_orphaned_resource(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `CreateOrphanedResource`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct CreateOrphanedResourceFluentBuilder { - client: crate::client::Client, - pub(crate) inner: crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInputBuilder, -} -impl CreateOrphanedResourceFluentBuilder { - /// Creates a new `CreateOrphanedResource`. - pub(crate) fn new(client: crate::client::Client) -> Self { - Self { - client, - inner: ::std::default::Default::default(), - } - } - /// Access the CreateOrphanedResource as a reference. - pub fn as_input(&self) -> &crate::operation::create_orphaned_resource::builders::CreateOrphanedResourceInputBuilder { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::operation::create_orphaned_resource::CreateOrphanedResourceOutput, - crate::types::error::Error, - > { - let input = self - .inner - .build() - // Using Opaque since we don't have a validation-specific error yet. - // Operations' models don't declare their own validation error, - // and smithy-rs seems to not generate a ValidationError case unless there is. - // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. - .map_err(|mut e| { - let msg = format!("{:?}", e); - crate::types::error::Error::OpaqueWithText { - obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any), - objMessage: msg - }})?; - crate::operation::create_orphaned_resource::CreateOrphanedResource::send(&self.client, input).await - } - - -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure.rs deleted file mode 100644 index 2bd643fb3a..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Orchestration and serialization glue logic for `CreateOrphanedStructure`. -#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -#[non_exhaustive] -pub struct CreateOrphanedStructure; -impl CreateOrphanedStructure { - /// Creates a new `CreateOrphanedStructure` - pub fn new() -> Self { - Self - } - - pub(crate) async fn send( - client: &crate::client::Client, - input: crate::operation::create_orphaned_structure::CreateOrphanedStructureInput, - ) -> ::std::result::Result< - crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, - crate::types::error::Error, - > { - - let inner_input = crate::conversions::create_orphaned_structure::_create_orphaned_structure_input::to_dafny(input); - let inner_result = - ::dafny_runtime::md!(client.dafny_client.clone()).CreateOrphanedStructure(&inner_input); - if matches!( - inner_result.as_ref(), - crate::r#_Wrappers_Compile::Result::Success { .. } - ) { - Ok( - crate::conversions::create_orphaned_structure::_create_orphaned_structure_output::from_dafny(inner_result.value().clone()), - ) - } else { - Err(crate::conversions::error::from_dafny( - inner_result.error().clone(), - )) - } - } -} - -pub use crate::operation::create_orphaned_structure::_create_orphaned_structure_output::CreateOrphanedStructureOutput; - -pub use crate::operation::create_orphaned_structure::_create_orphaned_structure_input::CreateOrphanedStructureInput; - -pub(crate) mod _create_orphaned_structure_output; - -pub(crate) mod _create_orphaned_structure_input; - -/// Builders -pub mod builders; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_input.rs deleted file mode 100644 index ec6aca355b..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_input.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedStructureInput { - -} -impl CreateOrphanedStructureInput { - -} -impl CreateOrphanedStructureInput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedStructureInput`](crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInput). - pub fn builder() -> crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInputBuilder { - crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedStructureInput`](crate::operation::operation::CreateOrphanedStructureInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedStructureInputBuilder { - -} -impl CreateOrphanedStructureInputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedStructureInput`](crate::operation::operation::CreateOrphanedStructureInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::create_orphaned_structure::CreateOrphanedStructureInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::create_orphaned_structure::CreateOrphanedStructureInput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_output.rs deleted file mode 100644 index ce2be17069..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/_create_orphaned_structure_output.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedStructureOutput { - -} -impl CreateOrphanedStructureOutput { - -} -impl CreateOrphanedStructureOutput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedStructureOutput`](crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureOutput). - pub fn builder() -> crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureOutputBuilder { - crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureOutputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedStructureOutput`](crate::operation::operation::CreateOrphanedStructureOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedStructureOutputBuilder { - -} -impl CreateOrphanedStructureOutputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedStructureOutput`](crate::operation::operation::CreateOrphanedStructureOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/builders.rs deleted file mode 100644 index f2fe536658..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/create_orphaned_structure/builders.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use crate::operation::create_orphaned_structure::_create_orphaned_structure_output::CreateOrphanedStructureOutputBuilder; - -pub use crate::operation::create_orphaned_structure::_create_orphaned_structure_input::CreateOrphanedStructureInputBuilder; - -impl CreateOrphanedStructureInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - client: &crate::client::Client, - ) -> ::std::result::Result< - crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, - crate::types::error::Error, - > { - let mut fluent_builder = client.create_orphaned_structure(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `CreateOrphanedStructure`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct CreateOrphanedStructureFluentBuilder { - client: crate::client::Client, - pub(crate) inner: crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInputBuilder, -} -impl CreateOrphanedStructureFluentBuilder { - /// Creates a new `CreateOrphanedStructure`. - pub(crate) fn new(client: crate::client::Client) -> Self { - Self { - client, - inner: ::std::default::Default::default(), - } - } - /// Access the CreateOrphanedStructure as a reference. - pub fn as_input(&self) -> &crate::operation::create_orphaned_structure::builders::CreateOrphanedStructureInputBuilder { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::operation::create_orphaned_structure::CreateOrphanedStructureOutput, - crate::types::error::Error, - > { - let input = self - .inner - .build() - // Using Opaque since we don't have a validation-specific error yet. - // Operations' models don't declare their own validation error, - // and smithy-rs seems to not generate a ValidationError case unless there is. - // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. - .map_err(|mut e| { - let msg = format!("{:?}", e); - crate::types::error::Error::OpaqueWithText { - obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any), - objMessage: msg - }})?; - crate::operation::create_orphaned_structure::CreateOrphanedStructure::send(&self.client, input).await - } - - -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation.rs deleted file mode 100644 index b2a9895398..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Orchestration and serialization glue logic for `OrphanedResourceOperation`. -#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] -#[non_exhaustive] -pub struct OrphanedResourceOperation; -impl OrphanedResourceOperation { - /// Creates a new `OrphanedResourceOperation` - pub fn new() -> Self { - Self - } - - pub(crate) async fn send( - orphaned_resource: &crate::types::orphaned_resource::OrphanedResourceRef, - input: crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, - ) -> ::std::result::Result< - crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, - crate::types::error::Error, - > { - - orphaned_resource.inner.borrow_mut().orphaned_resource_operation(input) - } -} - -pub use crate::operation::orphaned_resource_operation::_orphaned_resource_operation_output::OrphanedResourceOperationOutput; - -pub use crate::operation::orphaned_resource_operation::_orphaned_resource_operation_input::OrphanedResourceOperationInput; - -pub(crate) mod _orphaned_resource_operation_output; - -pub(crate) mod _orphaned_resource_operation_input; - -/// Builders -pub mod builders; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_input.rs deleted file mode 100644 index 8c727c316a..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_input.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct OrphanedResourceOperationInput { - #[allow(missing_docs)] -pub some_string: ::std::option::Option<::std::string::String>, -} -impl OrphanedResourceOperationInput { - #[allow(missing_docs)] -pub fn some_string(&self) -> &::std::option::Option<::std::string::String> { - &self.some_string -} -} -impl OrphanedResourceOperationInput { - /// Creates a new builder-style object to manufacture [`OrphanedResourceOperationInput`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInput). - pub fn builder() -> crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInputBuilder { - crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInputBuilder::default() - } -} - -/// A builder for [`OrphanedResourceOperationInput`](crate::operation::operation::OrphanedResourceOperationInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct OrphanedResourceOperationInputBuilder { - pub(crate) some_string: ::std::option::Option<::std::string::String>, -} -impl OrphanedResourceOperationInputBuilder { - #[allow(missing_docs)] -pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.some_string = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.some_string = input; - self -} -#[allow(missing_docs)] -pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { - &self.some_string -} - /// Consumes the builder and constructs a [`OrphanedResourceOperationInput`](crate::operation::operation::OrphanedResourceOperationInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput { - some_string: self.some_string, - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_output.rs deleted file mode 100644 index 82a3e7b38b..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/_orphaned_resource_operation_output.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct OrphanedResourceOperationOutput { - #[allow(missing_docs)] -pub some_string: ::std::option::Option<::std::string::String>, -} -impl OrphanedResourceOperationOutput { - #[allow(missing_docs)] -pub fn some_string(&self) -> &::std::option::Option<::std::string::String> { - &self.some_string -} -} -impl OrphanedResourceOperationOutput { - /// Creates a new builder-style object to manufacture [`OrphanedResourceOperationOutput`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationOutput). - pub fn builder() -> crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationOutputBuilder { - crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationOutputBuilder::default() - } -} - -/// A builder for [`OrphanedResourceOperationOutput`](crate::operation::operation::OrphanedResourceOperationOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct OrphanedResourceOperationOutputBuilder { - pub(crate) some_string: ::std::option::Option<::std::string::String>, -} -impl OrphanedResourceOperationOutputBuilder { - #[allow(missing_docs)] -pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.some_string = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.some_string = input; - self -} -#[allow(missing_docs)] -pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { - &self.some_string -} - /// Consumes the builder and constructs a [`OrphanedResourceOperationOutput`](crate::operation::operation::OrphanedResourceOperationOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput { - some_string: self.some_string, - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/builders.rs deleted file mode 100644 index 4b5020828b..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/operation/orphaned_resource_operation/builders.rs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use crate::operation::orphaned_resource_operation::_orphaned_resource_operation_output::OrphanedResourceOperationOutputBuilder; - -pub use crate::operation::orphaned_resource_operation::_orphaned_resource_operation_input::OrphanedResourceOperationInputBuilder; - -impl OrphanedResourceOperationInputBuilder { - /// Sends a request with this input using the given client. - pub async fn send_with( - self, - orphaned_resource: &crate::types::orphaned_resource::OrphanedResourceRef, - ) -> ::std::result::Result< - crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, - crate::types::error::Error, - > { - let mut fluent_builder = orphaned_resource.orphaned_resource_operation(); - fluent_builder.inner = self; - fluent_builder.send().await - } -} -/// Fluent builder constructing a request to `OrphanedResourceOperation`. -/// -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct OrphanedResourceOperationFluentBuilder { - orphaned_resource: crate::types::orphaned_resource::OrphanedResourceRef, - pub(crate) inner: crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInputBuilder, -} -impl OrphanedResourceOperationFluentBuilder { - /// Creates a new `OrphanedResourceOperation`. - pub(crate) fn new(orphaned_resource: crate::types::orphaned_resource::OrphanedResourceRef) -> Self { - Self { - orphaned_resource, - inner: ::std::default::Default::default(), - } - } - /// Access the OrphanedResourceOperation as a reference. - pub fn as_input(&self) -> &crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationInputBuilder { - &self.inner - } - /// Sends the request and returns the response. - pub async fn send( - self, - ) -> ::std::result::Result< - crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, - crate::types::error::Error, - > { - let input = self - .inner - .build() - // Using Opaque since we don't have a validation-specific error yet. - // Operations' models don't declare their own validation error, - // and smithy-rs seems to not generate a ValidationError case unless there is. - // Vanilla smithy-rs uses SdkError::construction_failure, but we aren't using SdkError. - .map_err(|mut e| { - let msg = format!("{:?}", e); - crate::types::error::Error::OpaqueWithText { - obj: ::dafny_runtime::Object::from_ref(&mut e as &mut dyn ::std::any::Any), - objMessage: msg - }})?; - crate::operation::orphaned_resource_operation::OrphanedResourceOperation::send(&self.orphaned_resource, input).await - } - - #[allow(missing_docs)] -pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.inner = self.inner.some_string(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.inner = self.inner.set_some_string(input); - self -} -#[allow(missing_docs)] -pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { - self.inner.get_some_string() -} -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs deleted file mode 100644 index 5c00049018..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_conversions.rs +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -pub fn ostring_to_dafny( - input: &Option, -) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, -> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&b) - }, - None => crate::_Wrappers_Compile::Option::None {}, -}; - ::std::rc::Rc::new(dafny_value) -} - -pub fn ostring_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - >, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some( - dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input.Extract(), - ), - ) - } else { - None - } -} - -pub fn obool_to_dafny( - input: &Option, -) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn obool_from_dafny( - input: ::std::rc::Rc>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn oint_to_dafny(input: Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn oint_from_dafny(input: ::std::rc::Rc>) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn olong_to_dafny(input: &Option) -> ::std::rc::Rc> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { value: *b }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn olong_from_dafny( - input: ::std::rc::Rc>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(input.Extract()) - } else { - None - } -} - -pub fn blob_to_dafny(input: &::aws_smithy_types::Blob) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence(&input.clone().into_inner(), |x| *x) -} - -pub fn oblob_to_dafny( - input: &Option<::aws_smithy_types::Blob>, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(b) => crate::_Wrappers_Compile::Option::Some { - value: blob_to_dafny(&b), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn blob_from_dafny(input: ::dafny_runtime::Sequence) -> ::aws_smithy_types::Blob { - ::aws_smithy_types::Blob::new( - ::std::rc::Rc::try_unwrap(input.to_array()).unwrap_or_else(|rc| (*rc).clone()), - ) -} - -pub fn oblob_from_dafny( - input: ::std::rc::Rc>>, -) -> Option<::aws_smithy_types::Blob> { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(blob_from_dafny(input.Extract())) - } else { - None - } -} - -pub fn double_to_dafny(input: f64) -> ::dafny_runtime::Sequence { - ::dafny_runtime::dafny_runtime_conversions::vec_to_dafny_sequence( - &f64::to_be_bytes(input).to_vec(), - |x| *x, - ) -} - -pub fn odouble_to_dafny( - input: &Option, -) -> ::std::rc::Rc>> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: double_to_dafny(*f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn double_from_dafny(input: &::dafny_runtime::Sequence) -> f64 { - let v = ::dafny_runtime::dafny_runtime_conversions::dafny_sequence_to_vec(input, |x| *x); - f64::from_be_bytes(v.try_into().expect("Error converting Sequence to f64")) -} - -pub fn odouble_from_dafny( - input: ::std::rc::Rc>>, -) -> Option { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(double_from_dafny(&input.Extract())) - } else { - None - } -} - -pub fn timestamp_to_dafny( - input: &::aws_smithy_types::DateTime, -) -> ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16> { - ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &input.to_string(), - ) -} - -pub fn otimestamp_to_dafny( - input: &Option<::aws_smithy_types::DateTime>, -) -> ::std::rc::Rc< - crate::_Wrappers_Compile::Option<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>, -> { - let dafny_value = match input { - Some(f) => crate::_Wrappers_Compile::Option::Some { - value: timestamp_to_dafny(f), - }, - None => crate::_Wrappers_Compile::Option::None {}, - }; - ::std::rc::Rc::new(dafny_value) -} - -pub fn timestamp_from_dafny( - input: ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, -) -> ::aws_smithy_types::DateTime { - let s = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string( - &input, - ); - ::aws_smithy_types::DateTime::from_str(&s, aws_smithy_types::date_time::Format::DateTime) - .unwrap() -} - -pub fn otimestamp_from_dafny( - input: ::std::rc::Rc< - crate::_Wrappers_Compile::Option< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - >, -) -> Option<::aws_smithy_types::DateTime> { - if matches!( - input.as_ref(), - crate::_Wrappers_Compile::Option::Some { .. } - ) { - Some(timestamp_from_dafny(input.Extract())) - } else { - None - } -} - -pub fn option_from_dafny( - input: ::std::rc::Rc>, - converter: fn(&T) -> TR, -) -> Option { - match &*input { - crate::_Wrappers_Compile::Option::Some { value } => Some(converter(value)), - crate::_Wrappers_Compile::Option::None {} => None, - } -} - -pub fn option_to_dafny( - input: &Option, - converter: fn(&TR) -> T, -) -> ::std::rc::Rc> { - match input { - Some(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::Some { - value: converter(&value), - }), - None => ::std::rc::Rc::new(crate::_Wrappers_Compile::Option::None {}), - } -} - -pub fn result_from_dafny( - input: ::std::rc::Rc>, - converter_t: fn(&T) -> TR, - converter_e: fn(&E) -> ER, -) -> Result { - match &*input { - crate::_Wrappers_Compile::Result::Success { value } => Ok(converter_t(value)), - crate::_Wrappers_Compile::Result::Failure { error } => Err(converter_e(error)), - } -} - -pub fn result_to_dafny( - input: &Result, - converter_t: fn(&TR) -> T, - converter_e: fn(&ER) -> E, -) -> ::std::rc::Rc> { - match input { - Ok(value) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Success { - value: converter_t(&value), - }), - Err(error) => ::std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure { - error: converter_e(&error), - }), - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs b/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs deleted file mode 100644 index 54198eafa0..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/standard_library_externs.rs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -// Annotation to ignore the case of this module -use crate::r#_Wrappers_Compile; -use crate::implementation_from_dafny::UTF8; - -impl crate::implementation_from_dafny::UTF8::_default { - pub fn Encode( - s: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ) -> ::std::rc::Rc< - r#_Wrappers_Compile::Result< - UTF8::ValidUTF8Bytes, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - let v = s.to_array(); - let mut _accumulator: Vec = vec![]; - // Use of .encode_utf8 method. - let mut surrogate: Option = None; - for c in v.iter() { - let s = if let Some(s) = surrogate { - String::from_utf16(&[s, c.0]) - } else { - String::from_utf16(&[c.0]) - }; - surrogate = None; - match s { - Ok(value) => { - _accumulator.extend(value.as_bytes()); - continue; - } - Err(e) => { - if 0xD800 <= c.0 && c.0 <= 0xDFFF { - surrogate = Some(c.0); - continue; - } - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &e.to_string()) - }); - } - } - } - if let Some(s) = surrogate { - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &format!("Surrogate pair missing: 0x{:04x}", s)) - }); - } - ::std::rc::Rc::new(r#_Wrappers_Compile::Result::< - UTF8::ValidUTF8Bytes, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >::Success { - value: ::dafny_runtime::Sequence::from_array_owned(_accumulator), - }) - } - pub fn Decode( - b: &::dafny_runtime::Sequence, - ) -> ::std::rc::Rc< - r#_Wrappers_Compile::Result< - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - >, - > { - let b = String::from_utf8(b.to_array().as_ref().clone()); - match b { - Ok(s) => { - ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Success { - value: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(&s) - }) - }, - Err(e) => { - return ::std::rc::Rc::new(r#_Wrappers_Compile::Result::<::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>, - ::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>>::Failure { - error: ::dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string( - &e.to_string()) - }) - } - } - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types.rs deleted file mode 100644 index 7a16420e89..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -/// Types for the `SimpleOrphanedConfig` -pub mod simple_orphaned_config; - -pub mod builders; - -pub mod orphaned_resource; -pub use orphaned_resource::OrphanedResource; - -mod _create_orphaned_error_input; -pub use crate::types::_create_orphaned_error_input::CreateOrphanedErrorInput; -mod _create_orphaned_error_output; -pub use crate::types::_create_orphaned_error_output::CreateOrphanedErrorOutput; -mod _create_orphaned_resource_input; -pub use crate::types::_create_orphaned_resource_input::CreateOrphanedResourceInput; -mod _create_orphaned_resource_output; -pub use crate::types::_create_orphaned_resource_output::CreateOrphanedResourceOutput; -mod _create_orphaned_structure_input; -pub use crate::types::_create_orphaned_structure_input::CreateOrphanedStructureInput; -mod _create_orphaned_structure_output; -pub use crate::types::_create_orphaned_structure_output::CreateOrphanedStructureOutput; -mod _orphaned_config_shape; -pub use crate::types::_orphaned_config_shape::OrphanedConfigShape; -mod _orphaned_resource_operation_input; -pub use crate::types::_orphaned_resource_operation_input::OrphanedResourceOperationInput; -mod _orphaned_resource_operation_output; -pub use crate::types::_orphaned_resource_operation_output::OrphanedResourceOperationOutput; -mod _orphaned_structure; -pub use crate::types::_orphaned_structure::OrphanedStructure; - -pub mod error; - -mod _orphaned_v1_enum; -pub use crate::types::_orphaned_v1_enum::OrphanedV1Enum; - -mod _orphaned_union; -pub use crate::types::_orphaned_union::OrphanedUnion; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_input.rs deleted file mode 100644 index 4d30939f4e..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_input.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedErrorInput { - -} -impl CreateOrphanedErrorInput { - -} -impl CreateOrphanedErrorInput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedErrorInput`](crate::types::CreateOrphanedErrorInput). - pub fn builder() -> crate::types::builders::CreateOrphanedErrorInputBuilder { - crate::types::builders::CreateOrphanedErrorInputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedErrorInput`](crate::types::CreateOrphanedErrorInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedErrorInputBuilder { - -} -impl CreateOrphanedErrorInputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedErrorInput`](crate::types::CreateOrphanedErrorInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::CreateOrphanedErrorInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::CreateOrphanedErrorInput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_output.rs deleted file mode 100644 index 5cddfae241..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_error_output.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedErrorOutput { - -} -impl CreateOrphanedErrorOutput { - -} -impl CreateOrphanedErrorOutput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedErrorOutput`](crate::types::CreateOrphanedErrorOutput). - pub fn builder() -> crate::types::builders::CreateOrphanedErrorOutputBuilder { - crate::types::builders::CreateOrphanedErrorOutputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedErrorOutput`](crate::types::CreateOrphanedErrorOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedErrorOutputBuilder { - -} -impl CreateOrphanedErrorOutputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedErrorOutput`](crate::types::CreateOrphanedErrorOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::CreateOrphanedErrorOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::CreateOrphanedErrorOutput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_input.rs deleted file mode 100644 index 39e36d6d33..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_input.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedResourceInput { - -} -impl CreateOrphanedResourceInput { - -} -impl CreateOrphanedResourceInput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedResourceInput`](crate::types::CreateOrphanedResourceInput). - pub fn builder() -> crate::types::builders::CreateOrphanedResourceInputBuilder { - crate::types::builders::CreateOrphanedResourceInputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedResourceInput`](crate::types::CreateOrphanedResourceInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedResourceInputBuilder { - -} -impl CreateOrphanedResourceInputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedResourceInput`](crate::types::CreateOrphanedResourceInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::CreateOrphanedResourceInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::CreateOrphanedResourceInput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_output.rs deleted file mode 100644 index c031642cca..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_resource_output.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedResourceOutput { - -} -impl CreateOrphanedResourceOutput { - -} -impl CreateOrphanedResourceOutput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedResourceOutput`](crate::types::CreateOrphanedResourceOutput). - pub fn builder() -> crate::types::builders::CreateOrphanedResourceOutputBuilder { - crate::types::builders::CreateOrphanedResourceOutputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedResourceOutput`](crate::types::CreateOrphanedResourceOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedResourceOutputBuilder { - -} -impl CreateOrphanedResourceOutputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedResourceOutput`](crate::types::CreateOrphanedResourceOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::CreateOrphanedResourceOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::CreateOrphanedResourceOutput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_input.rs deleted file mode 100644 index 9d5442751c..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_input.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedStructureInput { - -} -impl CreateOrphanedStructureInput { - -} -impl CreateOrphanedStructureInput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedStructureInput`](crate::types::CreateOrphanedStructureInput). - pub fn builder() -> crate::types::builders::CreateOrphanedStructureInputBuilder { - crate::types::builders::CreateOrphanedStructureInputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedStructureInput`](crate::types::CreateOrphanedStructureInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedStructureInputBuilder { - -} -impl CreateOrphanedStructureInputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedStructureInput`](crate::types::CreateOrphanedStructureInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::CreateOrphanedStructureInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::CreateOrphanedStructureInput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_output.rs deleted file mode 100644 index 4129f80fa5..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_create_orphaned_structure_output.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct CreateOrphanedStructureOutput { - -} -impl CreateOrphanedStructureOutput { - -} -impl CreateOrphanedStructureOutput { - /// Creates a new builder-style object to manufacture [`CreateOrphanedStructureOutput`](crate::types::CreateOrphanedStructureOutput). - pub fn builder() -> crate::types::builders::CreateOrphanedStructureOutputBuilder { - crate::types::builders::CreateOrphanedStructureOutputBuilder::default() - } -} - -/// A builder for [`CreateOrphanedStructureOutput`](crate::types::CreateOrphanedStructureOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct CreateOrphanedStructureOutputBuilder { - -} -impl CreateOrphanedStructureOutputBuilder { - - /// Consumes the builder and constructs a [`CreateOrphanedStructureOutput`](crate::types::CreateOrphanedStructureOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::CreateOrphanedStructureOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::CreateOrphanedStructureOutput { - - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_config_shape.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_config_shape.rs deleted file mode 100644 index e6c9636e35..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_config_shape.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct OrphanedConfigShape { - #[allow(missing_docs)] -pub string_member: ::std::option::Option<::std::string::String>, -} -impl OrphanedConfigShape { - #[allow(missing_docs)] -pub fn string_member(&self) -> &::std::option::Option<::std::string::String> { - &self.string_member -} -} -impl OrphanedConfigShape { - /// Creates a new builder-style object to manufacture [`OrphanedConfigShape`](crate::types::OrphanedConfigShape). - pub fn builder() -> crate::types::builders::OrphanedConfigShapeBuilder { - crate::types::builders::OrphanedConfigShapeBuilder::default() - } -} - -/// A builder for [`OrphanedConfigShape`](crate::types::OrphanedConfigShape). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct OrphanedConfigShapeBuilder { - pub(crate) string_member: ::std::option::Option<::std::string::String>, -} -impl OrphanedConfigShapeBuilder { - #[allow(missing_docs)] -pub fn string_member(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.string_member = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_string_member(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.string_member = input; - self -} -#[allow(missing_docs)] -pub fn get_string_member(&self) -> &::std::option::Option<::std::string::String> { - &self.string_member -} - /// Consumes the builder and constructs a [`OrphanedConfigShape`](crate::types::OrphanedConfigShape). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::OrphanedConfigShape, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::OrphanedConfigShape { - string_member: self.string_member, - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_input.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_input.rs deleted file mode 100644 index f1a2b9b734..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_input.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct OrphanedResourceOperationInput { - #[allow(missing_docs)] -pub some_string: ::std::option::Option<::std::string::String>, -} -impl OrphanedResourceOperationInput { - #[allow(missing_docs)] -pub fn some_string(&self) -> &::std::option::Option<::std::string::String> { - &self.some_string -} -} -impl OrphanedResourceOperationInput { - /// Creates a new builder-style object to manufacture [`OrphanedResourceOperationInput`](crate::types::OrphanedResourceOperationInput). - pub fn builder() -> crate::types::builders::OrphanedResourceOperationInputBuilder { - crate::types::builders::OrphanedResourceOperationInputBuilder::default() - } -} - -/// A builder for [`OrphanedResourceOperationInput`](crate::types::OrphanedResourceOperationInput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct OrphanedResourceOperationInputBuilder { - pub(crate) some_string: ::std::option::Option<::std::string::String>, -} -impl OrphanedResourceOperationInputBuilder { - #[allow(missing_docs)] -pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.some_string = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.some_string = input; - self -} -#[allow(missing_docs)] -pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { - &self.some_string -} - /// Consumes the builder and constructs a [`OrphanedResourceOperationInput`](crate::types::OrphanedResourceOperationInput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::OrphanedResourceOperationInput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::OrphanedResourceOperationInput { - some_string: self.some_string, - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_output.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_output.rs deleted file mode 100644 index 0f7e0d2d83..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_resource_operation_output.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct OrphanedResourceOperationOutput { - #[allow(missing_docs)] -pub some_string: ::std::option::Option<::std::string::String>, -} -impl OrphanedResourceOperationOutput { - #[allow(missing_docs)] -pub fn some_string(&self) -> &::std::option::Option<::std::string::String> { - &self.some_string -} -} -impl OrphanedResourceOperationOutput { - /// Creates a new builder-style object to manufacture [`OrphanedResourceOperationOutput`](crate::types::OrphanedResourceOperationOutput). - pub fn builder() -> crate::types::builders::OrphanedResourceOperationOutputBuilder { - crate::types::builders::OrphanedResourceOperationOutputBuilder::default() - } -} - -/// A builder for [`OrphanedResourceOperationOutput`](crate::types::OrphanedResourceOperationOutput). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct OrphanedResourceOperationOutputBuilder { - pub(crate) some_string: ::std::option::Option<::std::string::String>, -} -impl OrphanedResourceOperationOutputBuilder { - #[allow(missing_docs)] -pub fn some_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.some_string = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_some_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.some_string = input; - self -} -#[allow(missing_docs)] -pub fn get_some_string(&self) -> &::std::option::Option<::std::string::String> { - &self.some_string -} - /// Consumes the builder and constructs a [`OrphanedResourceOperationOutput`](crate::types::OrphanedResourceOperationOutput). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::OrphanedResourceOperationOutput, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::OrphanedResourceOperationOutput { - some_string: self.some_string, - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_structure.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_structure.rs deleted file mode 100644 index 7e1a8db8d9..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_structure.rs +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct OrphanedStructure { - #[allow(missing_docs)] -pub blob_value: ::std::option::Option<::aws_smithy_types::Blob>, -#[allow(missing_docs)] -pub boolean_value: ::std::option::Option<::std::primitive::bool>, -#[allow(missing_docs)] -pub enum_value: ::std::option::Option, -#[allow(missing_docs)] -pub integer_value: ::std::option::Option<::std::primitive::i32>, -#[allow(missing_docs)] -pub list_value: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -#[allow(missing_docs)] -pub long_value: ::std::option::Option<::std::primitive::i64>, -#[allow(missing_docs)] -pub map_value: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>, -#[allow(missing_docs)] -pub string_value: ::std::option::Option<::std::string::String>, -#[allow(missing_docs)] -pub union_value: ::std::option::Option, -} -impl OrphanedStructure { - #[allow(missing_docs)] -pub fn blob_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { - &self.blob_value -} -#[allow(missing_docs)] -pub fn boolean_value(&self) -> &::std::option::Option<::std::primitive::bool> { - &self.boolean_value -} -#[allow(missing_docs)] -pub fn enum_value(&self) -> &::std::option::Option { - &self.enum_value -} -#[allow(missing_docs)] -pub fn integer_value(&self) -> &::std::option::Option<::std::primitive::i32> { - &self.integer_value -} -#[allow(missing_docs)] -pub fn list_value(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { - &self.list_value -} -#[allow(missing_docs)] -pub fn long_value(&self) -> &::std::option::Option<::std::primitive::i64> { - &self.long_value -} -#[allow(missing_docs)] -pub fn map_value(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> { - &self.map_value -} -#[allow(missing_docs)] -pub fn string_value(&self) -> &::std::option::Option<::std::string::String> { - &self.string_value -} -#[allow(missing_docs)] -pub fn union_value(&self) -> &::std::option::Option { - &self.union_value -} -} -impl OrphanedStructure { - /// Creates a new builder-style object to manufacture [`OrphanedStructure`](crate::types::OrphanedStructure). - pub fn builder() -> crate::types::builders::OrphanedStructureBuilder { - crate::types::builders::OrphanedStructureBuilder::default() - } -} - -/// A builder for [`OrphanedStructure`](crate::types::OrphanedStructure). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct OrphanedStructureBuilder { - pub(crate) blob_value: ::std::option::Option<::aws_smithy_types::Blob>, -pub(crate) boolean_value: ::std::option::Option<::std::primitive::bool>, -pub(crate) enum_value: ::std::option::Option, -pub(crate) integer_value: ::std::option::Option<::std::primitive::i32>, -pub(crate) list_value: ::std::option::Option<::std::vec::Vec<::std::string::String>>, -pub(crate) long_value: ::std::option::Option<::std::primitive::i64>, -pub(crate) map_value: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>, -pub(crate) string_value: ::std::option::Option<::std::string::String>, -pub(crate) union_value: ::std::option::Option, -} -impl OrphanedStructureBuilder { - #[allow(missing_docs)] -pub fn blob_value(mut self, input: impl ::std::convert::Into<::aws_smithy_types::Blob>) -> Self { - self.blob_value = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_blob_value(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self { - self.blob_value = input; - self -} -#[allow(missing_docs)] -pub fn get_blob_value(&self) -> &::std::option::Option<::aws_smithy_types::Blob> { - &self.blob_value -} -#[allow(missing_docs)] -pub fn boolean_value(mut self, input: impl ::std::convert::Into<::std::primitive::bool>) -> Self { - self.boolean_value = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_boolean_value(mut self, input: ::std::option::Option<::std::primitive::bool>) -> Self { - self.boolean_value = input; - self -} -#[allow(missing_docs)] -pub fn get_boolean_value(&self) -> &::std::option::Option<::std::primitive::bool> { - &self.boolean_value -} -#[allow(missing_docs)] -pub fn enum_value(mut self, input: impl ::std::convert::Into) -> Self { - self.enum_value = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_enum_value(mut self, input: ::std::option::Option) -> Self { - self.enum_value = input; - self -} -#[allow(missing_docs)] -pub fn get_enum_value(&self) -> &::std::option::Option { - &self.enum_value -} -#[allow(missing_docs)] -pub fn integer_value(mut self, input: impl ::std::convert::Into<::std::primitive::i32>) -> Self { - self.integer_value = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_integer_value(mut self, input: ::std::option::Option<::std::primitive::i32>) -> Self { - self.integer_value = input; - self -} -#[allow(missing_docs)] -pub fn get_integer_value(&self) -> &::std::option::Option<::std::primitive::i32> { - &self.integer_value -} -#[allow(missing_docs)] -pub fn list_value(mut self, input: impl ::std::convert::Into<::std::vec::Vec<::std::string::String>>) -> Self { - self.list_value = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_list_value(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self { - self.list_value = input; - self -} -#[allow(missing_docs)] -pub fn get_list_value(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> { - &self.list_value -} -#[allow(missing_docs)] -pub fn long_value(mut self, input: impl ::std::convert::Into<::std::primitive::i64>) -> Self { - self.long_value = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_long_value(mut self, input: ::std::option::Option<::std::primitive::i64>) -> Self { - self.long_value = input; - self -} -#[allow(missing_docs)] -pub fn get_long_value(&self) -> &::std::option::Option<::std::primitive::i64> { - &self.long_value -} -#[allow(missing_docs)] -pub fn map_value(mut self, input: impl ::std::convert::Into<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self { - self.map_value = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_map_value(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self { - self.map_value = input; - self -} -#[allow(missing_docs)] -pub fn get_map_value(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> { - &self.map_value -} -#[allow(missing_docs)] -pub fn string_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { - self.string_value = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_string_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self { - self.string_value = input; - self -} -#[allow(missing_docs)] -pub fn get_string_value(&self) -> &::std::option::Option<::std::string::String> { - &self.string_value -} -#[allow(missing_docs)] -pub fn union_value(mut self, input: impl ::std::convert::Into) -> Self { - self.union_value = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_union_value(mut self, input: ::std::option::Option) -> Self { - self.union_value = input; - self -} -#[allow(missing_docs)] -pub fn get_union_value(&self) -> &::std::option::Option { - &self.union_value -} - /// Consumes the builder and constructs a [`OrphanedStructure`](crate::types::OrphanedStructure). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::OrphanedStructure, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::OrphanedStructure { - blob_value: self.blob_value, -boolean_value: self.boolean_value, -enum_value: self.enum_value, -integer_value: self.integer_value, -list_value: self.list_value, -long_value: self.long_value, -map_value: self.map_value, -string_value: self.string_value, -union_value: self.union_value, - }) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_union.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_union.rs deleted file mode 100644 index a90f6e5fa1..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_union.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub enum OrphanedUnion { - #[allow(missing_docs)] -IntegerValue(::std::primitive::i32), -#[allow(missing_docs)] -StringValue(::std::string::String), - /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version. - /// An unknown enum variant - /// - /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._ - /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized - /// by the client. This can happen when the server adds new functionality, but the client has not been updated. - /// To investigate this, consider turning on debug logging to print the raw HTTP response. - #[non_exhaustive] - Unknown, -} -impl OrphanedUnion { - /// Tries to convert the enum instance into [`IntegerValue`](crate::types::OrphanedUnion::IntegerValue), extracting the inner [`::std::primitive::i32`](::std::primitive::i32). -/// Returns `Err(&Self)` if it can't be converted. -pub fn as_integer_value(&self) -> ::std::result::Result<&::std::primitive::i32, &Self> { - if let crate::types::OrphanedUnion::IntegerValue(val) = &self { - ::std::result::Result::Ok(val) - } else { - ::std::result::Result::Err(self) - } -} -/// Tries to convert the enum instance into [`StringValue`](crate::types::OrphanedUnion::StringValue), extracting the inner [`::std::string::String`](::std::string::String). -/// Returns `Err(&Self)` if it can't be converted. -pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> { - if let crate::types::OrphanedUnion::StringValue(val) = &self { - ::std::result::Result::Ok(val) - } else { - ::std::result::Result::Err(self) - } -} - /// Returns true if this is a [`IntegerValue`](crate::types::OrphanedUnion::IntegerValue). -pub fn is_integer_value(&self) -> ::std::primitive::bool { - self.as_integer_value().is_ok() -} -/// Returns true if this is a [`StringValue`](crate::types::OrphanedUnion::StringValue). -pub fn is_string_value(&self) -> ::std::primitive::bool { - self.as_string_value().is_ok() -} - /// Returns true if the enum instance is the `Unknown` variant. - pub fn is_unknown(&self) -> ::std::primitive::bool { - matches!(self, Self::Unknown) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_v1_enum.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_v1_enum.rs deleted file mode 100644 index 6de6777284..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/_orphaned_v1_enum.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[derive(Debug, PartialEq, Copy, Clone)] -#[allow(missing_docs)] -pub enum OrphanedV1Enum { - First, -Second, -Third, -} - -impl ::std::fmt::Display for OrphanedV1Enum { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - match self { - OrphanedV1Enum::First => write!(f, "FIRST"), -OrphanedV1Enum::Second => write!(f, "SECOND"), -OrphanedV1Enum::Third => write!(f, "THIRD"), - } - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/builders.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/builders.rs deleted file mode 100644 index 82ebdf1b81..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/builders.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub use crate::types::_create_orphaned_error_input::CreateOrphanedErrorInputBuilder; - -pub use crate::types::_create_orphaned_error_output::CreateOrphanedErrorOutputBuilder; - -pub use crate::types::_create_orphaned_resource_input::CreateOrphanedResourceInputBuilder; - -pub use crate::types::_create_orphaned_resource_output::CreateOrphanedResourceOutputBuilder; - -pub use crate::types::_create_orphaned_structure_input::CreateOrphanedStructureInputBuilder; - -pub use crate::types::_create_orphaned_structure_output::CreateOrphanedStructureOutputBuilder; - -pub use crate::types::_orphaned_config_shape::OrphanedConfigShapeBuilder; - -pub use crate::types::_orphaned_resource_operation_input::OrphanedResourceOperationInputBuilder; - -pub use crate::types::_orphaned_resource_operation_output::OrphanedResourceOperationOutputBuilder; - -pub use crate::types::_orphaned_structure::OrphanedStructureBuilder; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/error.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/error.rs deleted file mode 100644 index dd505af9bd..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/error.rs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[derive(::std::clone::Clone, ::std::fmt::Debug, ::std::cmp::PartialEq)] -pub enum Error { - #[allow(missing_docs)] -OrphanedError { - message: ::std::string::String, -}, - CollectionOfErrors { - list: ::std::vec::Vec, - message: ::std::string::String, - }, - ValidationError(ValidationError), - Opaque { - obj: ::dafny_runtime::Object, - }, - OpaqueWithText { - obj: ::dafny_runtime::Object, - objMessage: ::std::string::String, - }, -} - -impl ::std::cmp::Eq for Error {} - -impl ::std::fmt::Display for Error { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - match self { - Self::ValidationError(err) => ::std::fmt::Display::fmt(err, f), - _ => ::std::fmt::Debug::fmt(self, f), - } - } -} - -impl ::std::error::Error for Error { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - match self { - Self::ValidationError(err) => Some(err), - _ => None, - } - } -} - -impl Error { - pub fn wrap_validation_err(err: E) -> Self - where - E: ::std::error::Error + 'static, - { - Self::ValidationError(ValidationError(::std::rc::Rc::new(err))) - } -} - -#[derive(::std::clone::Clone, ::std::fmt::Debug)] -pub struct ValidationError(::std::rc::Rc); - -impl ::std::cmp::PartialEq for ValidationError { - fn eq(&self, other: &Self) -> bool { - ::std::rc::Rc::<(dyn std::error::Error + 'static)>::ptr_eq(&self.0, &other.0) - } -} - -impl ::std::fmt::Display for ValidationError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - ::std::fmt::Display::fmt(&self.0, f) - } -} - -impl ::std::error::Error for ValidationError { - fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { - ::std::option::Option::Some(self.0.as_ref()) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource.rs deleted file mode 100644 index 02651ed266..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. - -#[allow(missing_docs)] -pub trait OrphanedResource { - fn orphaned_resource_operation( - &self, - input: crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput, - ) -> Result< - crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput, - crate::types::error::Error, - >; -} - -#[derive(::std::clone::Clone)] -/// A reference to a OrphanedResource -pub struct OrphanedResourceRef { - pub inner: ::std::rc::Rc> -} - -impl From for OrphanedResourceRef { - fn from(value: T) -> Self { - Self { inner: std::rc::Rc::new(std::cell::RefCell::new(value)) } - } -} - -impl ::std::cmp::PartialEq for OrphanedResourceRef { - fn eq(&self, other: &OrphanedResourceRef) -> bool { - ::std::rc::Rc::ptr_eq(&self.inner, &other.inner) - } -} - -impl ::std::fmt::Debug for OrphanedResourceRef { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "") - } -} - -mod orphaned_resource_operation; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource/orphaned_resource_operation.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource/orphaned_resource_operation.rs deleted file mode 100644 index b98dc9e406..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/orphaned_resource/orphaned_resource_operation.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -impl crate::types::orphaned_resource::OrphanedResourceRef { - /// Constructs a fluent builder for the [`OrphanedResourceOperation`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder) operation. - /// - /// - The fluent builder is configurable: - /// - [`some_string(impl Into>)`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder::some_string) / [`set_some_string(Option<::std::string::String>)`](crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder::set_some_string): (undocumented)
- /// - On success, responds with [`OrphanedResourceOperationOutput`](crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput) with field(s): - /// - [`some_string(Option<::std::string::String>)`](crate::operation::orphaned_resource_operation::OrphanedResourceOperationOutput::some_string): (undocumented) - /// - On failure, responds with [`SdkError`](crate::operation::orphaned_resource_operation::OrphanedResourceOperationError) - pub fn orphaned_resource_operation(&self) -> crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder { - crate::operation::orphaned_resource_operation::builders::OrphanedResourceOperationFluentBuilder::new(self.clone()) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/types/simple_orphaned_config.rs b/TestModels/OrphanedShapes/runtimes/rust/src/types/simple_orphaned_config.rs deleted file mode 100644 index eb80eea859..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/types/simple_orphaned_config.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -#[non_exhaustive] -#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] -#[allow(missing_docs)] -pub struct SimpleOrphanedConfig { - #[allow(missing_docs)] -pub structure_member: ::std::option::Option, -} -impl SimpleOrphanedConfig { - #[allow(missing_docs)] -pub fn structure_member(&self) -> &::std::option::Option { - &self.structure_member -} -} -impl SimpleOrphanedConfig { - /// Creates a new builder-style object to manufacture [`SimpleOrphanedConfig`](crate::types::SimpleOrphanedConfig). - pub fn builder() -> crate::types::simple_orphaned_config::SimpleOrphanedConfigBuilder { - crate::types::simple_orphaned_config::SimpleOrphanedConfigBuilder::default() - } -} - -/// A builder for [`SimpleOrphanedConfig`](crate::types::SimpleOrphanedConfig). -#[non_exhaustive] -#[derive( - ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug, -)] -pub struct SimpleOrphanedConfigBuilder { - pub(crate) structure_member: ::std::option::Option, -} -impl SimpleOrphanedConfigBuilder { - #[allow(missing_docs)] -pub fn structure_member(mut self, input: impl ::std::convert::Into) -> Self { - self.structure_member = ::std::option::Option::Some(input.into()); - self -} -#[allow(missing_docs)] -pub fn set_structure_member(mut self, input: ::std::option::Option) -> Self { - self.structure_member = input; - self -} -#[allow(missing_docs)] -pub fn get_structure_member(&self) -> &::std::option::Option { - &self.structure_member -} - /// Consumes the builder and constructs a [`SimpleOrphanedConfig`](crate::types::SimpleOrphanedConfig). - pub fn build( - self, - ) -> ::std::result::Result< - crate::types::simple_orphaned_config::SimpleOrphanedConfig, - ::aws_smithy_types::error::operation::BuildError, - > { - ::std::result::Result::Ok(crate::types::simple_orphaned_config::SimpleOrphanedConfig { - structure_member: self.structure_member, - }) - } -} From b03fc104aeb1036c572d5afa13e81e643b4ef5e0 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 14:21:08 -0800 Subject: [PATCH 18/32] m --- TestModels/.gitignore | 36 ++++---- .../ExternDefinitions/extern.go | 2 +- .../__default.java | 45 --------- .../python/src/simple_orphaned/__init__.py | 3 - .../extern/SimpleOrphanedImpl.py | 32 ------- .../internaldafny/extern/__init__.py | 3 - .../runtimes/rust/src/externs.rs | 0 .../OrphanedShapes/runtimes/rust/src/lib.rs | 2 +- .../runtimes/rust/src/simple_orphaned_impl.rs | 92 ------------------- .../runtimes/rust/src/wrapped/client.rs | 79 ---------------- .../OrphanedShapes/test/ExternDefinitions.dfy | 4 +- .../Model/RecursiveShape.smithy | 15 +-- .../smithydotnet/DotnetTestModels.java | 2 + .../polymorph/smithygo/GoTestModels.java | 2 + .../DafnyLocalServiceDirectedCodegen.java | 6 +- ...irectedDafnyPythonLocalServiceCodegen.java | 62 ++++++------- 16 files changed, 58 insertions(+), 327 deletions(-) delete mode 100644 TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedshapesImpl_Compile/__default.java delete mode 100644 TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/SimpleOrphanedImpl.py delete mode 100644 TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/__init__.py delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/externs.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/simple_orphaned_impl.rs diff --git a/TestModels/.gitignore b/TestModels/.gitignore index 4b47e7e4b0..8815c7af98 100644 --- a/TestModels/.gitignore +++ b/TestModels/.gitignore @@ -34,6 +34,23 @@ # Polymorph Generated Python **/runtimes/python/src/**/smithygenerated/ +# Polymorph Generated Rust +**/src/client.rs +**/src/client +**/src/conversions.rs +**/src/conversions +**/src/deps.rs +**/src/deps +**/src/error.rs +**/src/error +**/src/operation.rs +**/src/operation +**/src/standard_library_conversions.rs +**/src/standard_library_externs.rs +**/src/types.rs +**/src/types +**/target + # .NET Artifacts **/bin **/obj @@ -46,25 +63,6 @@ **/runtimes/python/poetry.lock **/runtimes/python/**/poetry.lock -# Rust Artifacts -Cargo.lock -src/client.rs -src/client -src/conversions.rs -src/conversions -src/deps.rs -src/deps -src/error.rs -src/error -src/implementation_from_dafny.rs -src/operation.rs -src/operation -src/standard_library_conversions.rs -src/standard_library_externs.rs -src/types.rs -src/types -target - # JetBrains **/.idea/ **/Folder.DotSettings.user diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go index 92c805b941..af3ffcf4d2 100644 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go @@ -34,7 +34,7 @@ func (CompanionStruct_Default___) CallNativeOrphanedResource(input *OrphanedReso func (CompanionStruct_Default___) CallNativeOrphanedError(input SimpleOrphanedTypes.Error) SimpleOrphanedTypes.Error { native_error := simpleorphanedsmithygenerated.Error_FromDafny(input) - native_error.Message = "the extern MUST use Smithy-generated conversions to set this value in the native error" + native_error.Message = "the extern MUST set this string using the catch-all error converter, NOT the orphaned error-specific converter" dafny_error_again := simpleorphanedsmithygenerated.Error_ToDafny(native_error) return dafny_error_again } diff --git a/TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedshapesImpl_Compile/__default.java b/TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedshapesImpl_Compile/__default.java deleted file mode 100644 index 14a9c391b5..0000000000 --- a/TestModels/OrphanedShapes/runtimes/java/src/main/java/SimpleOrphanedshapesImpl_Compile/__default.java +++ /dev/null @@ -1,45 +0,0 @@ -// Class _ExternBase___default -// Dafny class __default compiled into Java -package SimpleOrphanedImpl_Compile; - -import simple.orphaned.internaldafny.types.*; -import OrphanedResource_Compile.*; -import simple.orphaned.ToDafny; -import simple.orphaned.ToNative; -import Wrappers_Compile.*; - -@SuppressWarnings({"unchecked", "deprecation"}) -public class __default extends _ExternBase___default { - public static simple.orphaned.internaldafny.types.OrphanedStructure InitializeOrphanedStructure(simple.orphaned.internaldafny.types.OrphanedStructure input) { - simple.orphaned.model.OrphanedStructure nativeStructure = ToNative.OrphanedStructure(input); - simple.orphaned.model.OrphanedStructure newNativeStructure = nativeStructure.toBuilder().stringValue( - "the extern MUST use Smithy-generated conversions to set this value in the native structure" - ).build(); - simple.orphaned.internaldafny.types.OrphanedStructure newDafnyStructure = ToDafny.OrphanedStructure(newNativeStructure); - return newDafnyStructure; - } - - public static Result CallNativeOrphanedResource(OrphanedResource_Compile.OrphanedResource input) { - simple.orphaned.IOrphanedResource nativeResource = ToNative.OrphanedResource(input); - simple.orphaned.model.OrphanedResourceOperationOutput output = nativeResource.OrphanedResourceOperation( - simple.orphaned.model.OrphanedResourceOperationInput.builder() - .someString("the extern MUST provide this string to the native resource's operation") - .build() - ); - simple.orphaned.internaldafny.types.OrphanedResourceOperationOutput dafnyOutput = ToDafny.OrphanedResourceOperationOutput(output); - return Result.create_Success( - simple.orphaned.internaldafny.types.OrphanedResourceOperationOutput._typeDescriptor(), - simple.orphaned.internaldafny.types.Error._typeDescriptor(), - dafnyOutput - ); - } - - public static simple.orphaned.internaldafny.types.Error CallNativeOrphanedError(simple.orphaned.internaldafny.types.Error input) { - simple.orphaned.model.OrphanedError nativeError = ToNative.Error((simple.orphaned.internaldafny.types.Error_OrphanedError) input); - simple.orphaned.model.OrphanedError updatedNativeError = nativeError.toBuilder() - .message("the extern MUST use Smithy-generated conversions to set this value in the native error") - .build(); - simple.orphaned.internaldafny.types.Error dafnyErrorAgain = ToDafny.Error(updatedNativeError); - return dafnyErrorAgain; - } -} diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/__init__.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/__init__.py index b9427e19da..67a3d57bd7 100644 --- a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/__init__.py +++ b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/__init__.py @@ -3,6 +3,3 @@ # Initialize generated Dafny from .internaldafny.generated import module_ - -# Initialize externs -from .internaldafny import extern diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/SimpleOrphanedImpl.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/SimpleOrphanedImpl.py deleted file mode 100644 index 882039af44..0000000000 --- a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/SimpleOrphanedImpl.py +++ /dev/null @@ -1,32 +0,0 @@ -import simple_orphaned.internaldafny.generated.SimpleOrphanedImpl -from simple_orphaned.internaldafny.generated.SimpleOrphanedImpl import * -import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers - -class default__(simple_orphaned.internaldafny.generated.SimpleOrphanedImpl.default__): - - @staticmethod - def InitializeOrphanedStructure(dafny_uninitialized_structure): - native_structure = simple_orphaned.smithygenerated.simple_orphaned.dafny_to_smithy.simple_orphaned_OrphanedStructure(dafny_uninitialized_structure) - native_structure.string_value = "the extern MUST use Smithy-generated conversions to set this value in the native structure" - dafny_initialized_structure = simple_orphaned.smithygenerated.simple_orphaned.smithy_to_dafny.simple_orphaned_OrphanedStructure(native_structure) - return dafny_initialized_structure - - @staticmethod - def CallNativeOrphanedResource(dafny_resource): - native_resource = simple_orphaned.smithygenerated.simple_orphaned.dafny_to_smithy.simple_orphaned_OrphanedResourceReference(dafny_resource) - native_output = native_resource.orphaned_resource_operation( - simple_orphaned.smithygenerated.simple_orphaned.models.OrphanedResourceOperationInput( - some_string = "the extern MUST provide this string to the native resource's operation" - ) - ) - dafny_output = simple_orphaned.smithygenerated.simple_orphaned.smithy_to_dafny.simple_orphaned_OrphanedResourceOperationOutput(native_output) - return Wrappers.Result_Success(dafny_output) - - @staticmethod - def CallNativeOrphanedError(dafny_error): - native_error = simple_orphaned.smithygenerated.simple_orphaned.deserialize._deserialize_error(dafny_error) - native_error.message = "the extern MUST use Smithy-generated conversions to set this value in the native error" - dafny_error_again = simple_orphaned.smithygenerated.simple_orphaned.errors._smithy_error_to_dafny_error(native_error) - return dafny_error_again - -simple_orphaned.internaldafny.generated.SimpleOrphanedImpl.default__ = default__ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/__init__.py b/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/__init__.py deleted file mode 100644 index 32c9026249..0000000000 --- a/TestModels/OrphanedShapes/runtimes/python/src/simple_orphaned/internaldafny/extern/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from . import ( - SimpleOrphanedImpl, -) \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/externs.rs b/TestModels/OrphanedShapes/runtimes/rust/src/externs.rs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs b/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs index a54dfeafad..650eef6eb0 100644 --- a/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs +++ b/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs @@ -18,7 +18,7 @@ mod standard_library_conversions; mod standard_library_externs; pub mod types; pub mod wrapped; -pub mod simple_orphaned_impl; +pub mod extern_definitions; pub(crate) use crate::implementation_from_dafny::r#_Wrappers_Compile; pub(crate) use crate::implementation_from_dafny::simple; pub use crate::types::simple_orphaned_config::SimpleOrphanedConfig; diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/simple_orphaned_impl.rs b/TestModels/OrphanedShapes/runtimes/rust/src/simple_orphaned_impl.rs deleted file mode 100644 index 060483bc05..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/simple_orphaned_impl.rs +++ /dev/null @@ -1,92 +0,0 @@ -use std::rc::Rc; -use std::cell::UnsafeCell; -use dafny_runtime::rcmut; -use crate::r#_Wrappers_Compile::Result; - -pub mod internal_SimpleOrphanedImpl_Compile { - - use crate::conversions::*; - use crate::types::*; - use crate::implementation_from_dafny::_OrphanedResource_Compile::*; - use crate::implementation_from_dafny::_SimpleOrphanedImpl_Compile::_default; - use crate::simple::orphaned::internaldafny::types::*; - - - impl _default { - pub fn InitializeOrphanedStructure( - uninitialized_structure: &Rc, - ) -> Rc { - // Rc::clone(uninitialized_structure) - let native_structure = orphaned_structure::from_dafny(uninitialized_structure.clone()); - // I don't think generated Rust objects have a "toBuilder" method. - // Ideally, this extern would convert the Dafny structure to native, - // then set this property on the converted native structure. - // But that is sort of outside the scope of this TestModel. - // The fact that the from/to_dafny conversions above and below exist are the important things. - let native_structure_new = crate::types::OrphanedStructure::builder().set_string_value(Some( - "the extern MUST use Smithy-generated conversions to set this value in the native structure".to_string() - )).build().unwrap(); - return orphaned_structure::to_dafny(&native_structure_new); - } - - pub fn CallNativeOrphanedResource( - dafny_resource: &Object, - ) -> Rc, Rc>> - { - // let cloned_dafny_resource: Object = Rc::new(*dafny_resource.clone()); - // let cloned_dafny_resource: Object = Rc::clone(dafny_resource) as Object; - // let native_resource = orphaned_resource::from_dafny(cloned_dafny_resource).inner.borrow(); - // let cloned_dafny_resource: Object = Rc::new(*Rc::clone(dafny_resource)); - // let native_resource_ref = orphaned_resource::from_dafny(Object(Some(dafny_runtime::rcmut::RcMut::new(Box::new(*dafny_resource) as Box))); - // let native_resource_ref = orphaned_resource::from_dafny(Object::new(Box::new(*dafny_resource) as Box)); - // let native_resource_ref = orphaned_resource::from_dafny(dafny_runtime::Object(*(dafny_resource as &dyn IOrphanedResource))); - - let wrap = crate::conversions::orphaned_resource::IOrphanedResourceDafnyWrapper { - obj: dafny_resource.clone(), - }; - let native_resource_ref = crate::types::orphaned_resource::OrphanedResourceRef { - inner: ::std::rc::Rc::new(::std::cell::RefCell::new(wrap)) - }; - - // let rc_trait_object: Rc> = Rc::new(std::cell::UnsafeCell::new((*dafny_resource))); - // let option_trait_object: Option>> = Some(rc_trait_object); - // let native_resource_ref = orphaned_resource::from_dafny(Object(option_trait_object)); - - - let native_resource = native_resource_ref.inner.borrow(); - let native_output = native_resource.orphaned_resource_operation( - crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput{ - some_string : std::option::Option::Some ( - "the extern MUST provide this string to the native resource's operation".to_string() - ) - } - ); - - let dafny_output = orphaned_resource_operation::_orphaned_resource_operation_output::to_dafny(native_output.unwrap()); - - ::std::rc::Rc::new(Result::< - Rc, - Rc - >::Success { - value: dafny_output, - }) - } - - pub fn CallNativeOrphanedError( - dafny_error: &Rc, - ) -> Rc { - // Rc::clone(uninitialized_structure) - let native_error = crate::conversions::error::from_dafny(dafny_error.clone()); - // I don't think generated Rust objects have a "toBuilder" method. - // Ideally, this extern would convert the Dafny structure to native, - // then set this property on the converted native structure. - // But that is sort of outside the scope of this TestModel. - // The fact that the from/to_dafny conversions above and below exist are the important things. - let native_error_new = crate::types::error::Error::OrphanedError { - message : "the extern MUST use Smithy-generated conversions to set this value in the native error".to_string() - }; - return crate::conversions::error::to_dafny(native_error_new); - } - } - -} \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs index 5b73f4518c..d17c62c786 100644 --- a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs +++ b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs @@ -57,84 +57,5 @@ impl Client { } impl crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient for Client { - fn CreateOrphanedError( - &self, - input: &::std::rc::Rc, - ) -> std::rc::Rc< - crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc, - std::rc::Rc, - >, - >{ - let inner_input = crate::conversions::create_orphaned_error::_create_orphaned_error_input::from_dafny(input.clone()); - let result = tokio::task::block_in_place(|| { - dafny_tokio_runtime.block_on(crate::operation::create_orphaned_error::CreateOrphanedError::send(&self.wrapped, inner_input)) - }); - match result { - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: crate::conversions::error::to_dafny(error), - }, - ), - Ok(inner_result) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: crate::conversions::create_orphaned_error::_create_orphaned_error_output::to_dafny(inner_result), - }, - ), - } - } - - fn CreateOrphanedStructure( - &self, - input: &::std::rc::Rc, - ) -> std::rc::Rc< - crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc, - std::rc::Rc, - >, - >{ - let inner_input = crate::conversions::create_orphaned_structure::_create_orphaned_structure_input::from_dafny(input.clone()); - let result = tokio::task::block_in_place(|| { - dafny_tokio_runtime.block_on(crate::operation::create_orphaned_structure::CreateOrphanedStructure::send(&self.wrapped, inner_input)) - }); - match result { - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: crate::conversions::error::to_dafny(error), - }, - ), - Ok(inner_result) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: crate::conversions::create_orphaned_structure::_create_orphaned_structure_output::to_dafny(inner_result), - }, - ), - } - } - fn CreateOrphanedResource( - &self, - input: &::std::rc::Rc, - ) -> std::rc::Rc< - crate::r#_Wrappers_Compile::Result< - ::std::rc::Rc, - std::rc::Rc, - >, - >{ - let inner_input = crate::conversions::create_orphaned_resource::_create_orphaned_resource_input::from_dafny(input.clone()); - let result = tokio::task::block_in_place(|| { - dafny_tokio_runtime.block_on(crate::operation::create_orphaned_resource::CreateOrphanedResource::send(&self.wrapped, inner_input)) - }); - match result { - Err(error) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Failure { - error: crate::conversions::error::to_dafny(error), - }, - ), - Ok(inner_result) => ::std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: crate::conversions::create_orphaned_resource::_create_orphaned_resource_output::to_dafny(inner_result), - }, - ), - } - } } diff --git a/TestModels/OrphanedShapes/test/ExternDefinitions.dfy b/TestModels/OrphanedShapes/test/ExternDefinitions.dfy index 1b28a46315..94dccd533c 100644 --- a/TestModels/OrphanedShapes/test/ExternDefinitions.dfy +++ b/TestModels/OrphanedShapes/test/ExternDefinitions.dfy @@ -1,7 +1,7 @@ include "../Model/SimpleOrphanedTypes.dfy" include "../src/OrphanedResource.dfy" -module ExternDefinitions { +module {:extern} ExternDefinitions { import opened Wrappers import Types = SimpleOrphanedTypes @@ -33,7 +33,7 @@ module ExternDefinitions { var out_error := CallNativeOrphanedError(error); expect out_error.OrphanedError?; - expect out_error.message == "the extern MUST use Smithy-generated conversions to set this value in the native error"; + expect out_error.message == "the extern MUST set this string using the catch-all error converter, NOT the orphaned error-specific converter"; } // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. diff --git a/TestModels/RecursiveShape/Model/RecursiveShape.smithy b/TestModels/RecursiveShape/Model/RecursiveShape.smithy index a99ec2db23..d6635c6e89 100644 --- a/TestModels/RecursiveShape/Model/RecursiveShape.smithy +++ b/TestModels/RecursiveShape/Model/RecursiveShape.smithy @@ -9,7 +9,7 @@ namespace simple.recursiveShape service SimpleRecursiveShape { version: "2021-11-01", resources: [], - operations: [ GetRecursiveShape, GetRecursiveStructure ], + operations: [ GetRecursiveShape ], errors: [], } @@ -20,11 +20,6 @@ operation GetRecursiveShape { output: GetRecursiveShapeOutput, } -operation GetRecursiveStructure { - input: StructureWithRecursionOne, - output: StructureWithRecursionOne, -} - structure GetRecursiveShapeInput { recursiveUnion: RecursiveUnion } @@ -51,11 +46,3 @@ map MapWithRecursion { structure StructureWithRecursion { content: RecursiveUnion } - -structure StructureWithRecursionOne { - content: StructureWithRecursionTwo -} - -structure StructureWithRecursionTwo { - content: StructureWithRecursionOne -} \ No newline at end of file diff --git a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithydotnet/DotnetTestModels.java b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithydotnet/DotnetTestModels.java index e8ba210c58..7eb5dc23ef 100644 --- a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithydotnet/DotnetTestModels.java +++ b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithydotnet/DotnetTestModels.java @@ -21,6 +21,8 @@ class DotnetTestModels extends TestModelTest { DISABLED_TESTS.add("Documentation"); DISABLED_TESTS.add("LanguageSpecificLogic"); DISABLED_TESTS.add("LocalService"); + // Needs work to generate some missing orphaned shape conversion methods + DISABLED_TESTS.add("OrphanedShapes"); DISABLED_TESTS.add("SimpleTypes/BigDecimal"); DISABLED_TESTS.add("SimpleTypes/BigInteger"); DISABLED_TESTS.add("SimpleTypes/SimpleByte"); diff --git a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithygo/GoTestModels.java b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithygo/GoTestModels.java index 6a3e4be93c..81563814a6 100644 --- a/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithygo/GoTestModels.java +++ b/codegen/smithy-dafny-codegen-test/src/test/java/software/amazon/polymorph/smithygo/GoTestModels.java @@ -19,6 +19,8 @@ class GoTestModels extends TestModelTest { DISABLED_TESTS.add("AggregateReferences"); DISABLED_TESTS.add("Documentation"); DISABLED_TESTS.add("LanguageSpecificLogic"); + // Needs work to generate some missing orphaned shape conversion methods + DISABLED_TESTS.add("OrphanedShapes"); DISABLED_TESTS.add("SimpleTypes/BigDecimal"); DISABLED_TESTS.add("SimpleTypes/BigInteger"); DISABLED_TESTS.add("SimpleTypes/SimpleByte"); diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceDirectedCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceDirectedCodegen.java index 0cbb0f2bb6..e470c92eea 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceDirectedCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceDirectedCodegen.java @@ -213,11 +213,7 @@ protected void generateOrphanedShapesForService( ShapeType.INTEGER, ShapeType.UNION, ShapeType.STRING, - ShapeType.LONG, - ShapeType.BLOB, - ShapeType.BOOLEAN, - ShapeType.LIST, - ShapeType.MAP + ShapeType.LONG ); for (final var shapeToGenerate : orderedShapes) { diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index ddffa91e86..2b1545c366 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -535,34 +535,34 @@ protected void generateOrphanedShapesForService( shapeToGenerate ); } - - final WriterDelegator delegator = directive.context().writerDelegator(); - final String moduleName = - SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( - directive.context().settings().getService().getNamespace() - ); - - delegator.useFileWriter( - moduleName + "/dafny_to_smithy.py", - "", - conversionWriter -> { - DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( - shapeToGenerate, - directive.context(), - conversionWriter - ); - }); - - delegator.useFileWriter( - moduleName + "/smithy_to_dafny.py", - "", - conversionWriter -> { - LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( - shapeToGenerate, - directive.context(), - conversionWriter - ); - }); +// +// final WriterDelegator delegator = directive.context().writerDelegator(); +// final String moduleName = +// SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( +// directive.context().settings().getService().getNamespace() +// ); +// +// delegator.useFileWriter( +// moduleName + "/dafny_to_smithy.py", +// "", +// conversionWriter -> { +// DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( +// shapeToGenerate, +// directive.context(), +// conversionWriter +// ); +// }); +// +// delegator.useFileWriter( +// moduleName + "/smithy_to_dafny.py", +// "", +// conversionWriter -> { +// LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( +// shapeToGenerate, +// directive.context(), +// conversionWriter +// ); +// }); } } @@ -651,12 +651,12 @@ public void generateService( protocolGenerator.generateSharedDeserializerComponents(directive.context()); protocolGenerator.generateResponseDeserializers(directive.context()); - // Generate any missing conversion. functions + // Generate any missing conversion. // This SHOULD run after generateRequestSerializers and generateResponseDeserializers // to preserve topological ordering of generated functions. // I don't think that topological ordering is required here - // (no function's top-level definition depend on another function in this file) - // but this could change in the far future, so best to preserve the correct ordering. + // (no function's top-level definition depends on another function in this file) + // but this could change in the future, so best to preserve the correct ordering. // (An orphaned conversion function MAY depend on a non-orphaned conversion function, // but never the other way around.) generateOrphanedShapeConversionMethods(directive); From 4df19f18214e2778e1811412020c422ade2a17db Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 14:36:35 -0800 Subject: [PATCH 19/32] m --- .../ExternDefinitions_Compile/__default.java | 45 +++++++++ .../test/internaldafny/extern/test_externs.py | 33 +++++++ .../runtimes/rust/src/extern_definitions.rs | 93 +++++++++++++++++++ 3 files changed, 171 insertions(+) create mode 100644 TestModels/OrphanedShapes/runtimes/java/src/test/java/ExternDefinitions_Compile/__default.java create mode 100644 TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/test_externs.py create mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs diff --git a/TestModels/OrphanedShapes/runtimes/java/src/test/java/ExternDefinitions_Compile/__default.java b/TestModels/OrphanedShapes/runtimes/java/src/test/java/ExternDefinitions_Compile/__default.java new file mode 100644 index 0000000000..8f487931d7 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/java/src/test/java/ExternDefinitions_Compile/__default.java @@ -0,0 +1,45 @@ +// Class _ExternBase___default +// Dafny class __default compiled into Java +package ExternDefinitions_Compile; + +import simple.orphaned.internaldafny.types.*; +import OrphanedResource_Compile.*; +import simple.orphaned.ToDafny; +import simple.orphaned.ToNative; +import Wrappers_Compile.*; + +@SuppressWarnings({"unchecked", "deprecation"}) +public class __default extends _ExternBase___default { + public static simple.orphaned.internaldafny.types.OrphanedStructure InitializeOrphanedStructure(simple.orphaned.internaldafny.types.OrphanedStructure input) { + simple.orphaned.model.OrphanedStructure nativeStructure = ToNative.OrphanedStructure(input); + simple.orphaned.model.OrphanedStructure newNativeStructure = nativeStructure.toBuilder().stringValue( + "the extern MUST use Smithy-generated conversions to set this value in the native structure" + ).build(); + simple.orphaned.internaldafny.types.OrphanedStructure newDafnyStructure = ToDafny.OrphanedStructure(newNativeStructure); + return newDafnyStructure; + } + + public static Result CallNativeOrphanedResource(OrphanedResource_Compile.OrphanedResource input) { + simple.orphaned.IOrphanedResource nativeResource = ToNative.OrphanedResource(input); + simple.orphaned.model.OrphanedResourceOperationOutput output = nativeResource.OrphanedResourceOperation( + simple.orphaned.model.OrphanedResourceOperationInput.builder() + .someString("the extern MUST provide this string to the native resource's operation") + .build() + ); + simple.orphaned.internaldafny.types.OrphanedResourceOperationOutput dafnyOutput = ToDafny.OrphanedResourceOperationOutput(output); + return Result.create_Success( + simple.orphaned.internaldafny.types.OrphanedResourceOperationOutput._typeDescriptor(), + simple.orphaned.internaldafny.types.Error._typeDescriptor(), + dafnyOutput + ); + } + + public static simple.orphaned.internaldafny.types.Error CallNativeOrphanedError(simple.orphaned.internaldafny.types.Error input) { + simple.orphaned.model.OrphanedError nativeError = ToNative.Error((simple.orphaned.internaldafny.types.Error_OrphanedError) input); + simple.orphaned.model.OrphanedError updatedNativeError = nativeError.toBuilder() + .message("the extern MUST set this string using the catch-all error converter, NOT the orphaned error-specific converter") + .build(); + simple.orphaned.internaldafny.types.Error dafnyErrorAgain = ToDafny.Error(updatedNativeError); + return dafnyErrorAgain; + } +} diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/test_externs.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/test_externs.py new file mode 100644 index 0000000000..db73ea77c1 --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/test_externs.py @@ -0,0 +1,33 @@ +import ExternDefinitions +import simple_orphaned +import simple_orphaned.smithygenerated.simple_orphaned.deserialize +import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers + +class default__(ExternDefinitions.default__): + + @staticmethod + def InitializeOrphanedStructure(dafny_uninitialized_structure): + native_structure = simple_orphaned.smithygenerated.simple_orphaned.dafny_to_smithy.simple_orphaned_OrphanedStructure(dafny_uninitialized_structure) + native_structure.string_value = "the extern MUST use Smithy-generated conversions to set this value in the native structure" + dafny_initialized_structure = simple_orphaned.smithygenerated.simple_orphaned.smithy_to_dafny.simple_orphaned_OrphanedStructure(native_structure) + return dafny_initialized_structure + + @staticmethod + def CallNativeOrphanedResource(dafny_resource): + native_resource = simple_orphaned.smithygenerated.simple_orphaned.dafny_to_smithy.simple_orphaned_OrphanedResourceReference(dafny_resource) + native_output = native_resource.orphaned_resource_operation( + simple_orphaned.smithygenerated.simple_orphaned.models.OrphanedResourceOperationInput( + some_string = "the extern MUST provide this string to the native resource's operation" + ) + ) + dafny_output = simple_orphaned.smithygenerated.simple_orphaned.smithy_to_dafny.simple_orphaned_OrphanedResourceOperationOutput(native_output) + return Wrappers.Result_Success(dafny_output) + + @staticmethod + def CallNativeOrphanedError(dafny_error): + native_error = simple_orphaned.smithygenerated.simple_orphaned.deserialize._deserialize_error(dafny_error) + native_error.message = "the extern MUST set this string using the catch-all error converter, NOT the orphaned error-specific converter" + dafny_error_again = simple_orphaned.smithygenerated.simple_orphaned.errors._smithy_error_to_dafny_error(native_error) + return dafny_error_again + +ExternDefinitions.default__ = default__ \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs b/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs new file mode 100644 index 0000000000..9f0fc49b9c --- /dev/null +++ b/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs @@ -0,0 +1,93 @@ +use std::rc::Rc; +use std::cell::UnsafeCell; +use dafny_runtime::rcmut; +use crate::r#_Wrappers_Compile::Result; + +pub mod internal_ExternDefinitions_Compile { + + use crate::conversions::*; + use crate::types::*; + use crate::implementation_from_dafny::_OrphanedResource_Compile::*; + use crate::implementation_from_dafny::_ExternDefinitions_Compile::_default; + use crate::simple::orphaned::internaldafny::types::*; + + + impl _default { + pub fn InitializeOrphanedStructure( + uninitialized_structure: &Rc, + ) -> Rc { + // Rc::clone(uninitialized_structure) + let native_structure = orphaned_structure::from_dafny(uninitialized_structure.clone()); + // I don't think generated Rust objects have a "toBuilder" method. + // Ideally, this extern would convert the Dafny structure to native, + // then set this property on the converted native structure. + // But that is sort of outside the scope of this TestModel. + // The fact that the from/to_dafny conversions above and below exist are the important things. + let native_structure_new = crate::types::OrphanedStructure::builder().set_string_value(Some( + "the extern MUST use Smithy-generated conversions to set this value in the native structure".to_string() + )).build().unwrap(); + return orphaned_structure::to_dafny(&native_structure_new); + } + + pub fn CallNativeOrphanedResource( + dafny_resource: &Object, + ) -> Rc, Rc>> + { + // let cloned_dafny_resource: Object = Rc::new(*dafny_resource.clone()); + // let cloned_dafny_resource: Object = Rc::clone(dafny_resource) as Object; + // let native_resource = orphaned_resource::from_dafny(cloned_dafny_resource).inner.borrow(); + // let cloned_dafny_resource: Object = Rc::new(*Rc::clone(dafny_resource)); + // let native_resource_ref = orphaned_resource::from_dafny(Object(Some(dafny_runtime::rcmut::RcMut::new(Box::new(*dafny_resource) as Box))); + // let native_resource_ref = orphaned_resource::from_dafny(Object::new(Box::new(*dafny_resource) as Box)); + // let native_resource_ref = orphaned_resource::from_dafny(dafny_runtime::Object(*(dafny_resource as &dyn IOrphanedResource))); + + let wrap = crate::conversions::orphaned_resource::IOrphanedResourceDafnyWrapper { + obj: dafny_resource.clone(), + }; + let native_resource_ref = crate::types::orphaned_resource::OrphanedResourceRef { + inner: ::std::rc::Rc::new(::std::cell::RefCell::new(wrap)) + }; + + // let rc_trait_object: Rc> = Rc::new(std::cell::UnsafeCell::new((*dafny_resource))); + // let option_trait_object: Option>> = Some(rc_trait_object); + // let native_resource_ref = orphaned_resource::from_dafny(Object(option_trait_object)); + + + let native_resource = native_resource_ref.inner.borrow(); + let native_output = native_resource.orphaned_resource_operation( + crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput{ + some_string : std::option::Option::Some ( + "the extern MUST provide this string to the native resource's operation".to_string() + ) + } + ); + + let dafny_output = orphaned_resource_operation::_orphaned_resource_operation_output::to_dafny(native_output.unwrap()); + + ::std::rc::Rc::new(Result::< + Rc, + Rc + >::Success { + value: dafny_output, + }) + } + + pub fn CallNativeOrphanedError( + dafny_error: &Rc, + ) -> Rc { + // Rc::clone(uninitialized_structure) + let native_error = crate::conversions::error::from_dafny(dafny_error.clone()); + // I don't think generated Rust objects have a way for me to update the message + // on a pre-existing object (i.e. public fields or a .toBuilder). + // Ideally, this extern would convert the Dafny structure to native, + // then set this property on the converted native structure. + // But that is sort of outside the scope of this TestModel. + // The fact that the from/to_dafny conversions above and below exist are the important things. + let native_error_new = crate::types::error::Error::OrphanedError { + message : "the extern MUST set this string using the catch-all error converter, NOT the orphaned error-specific converter".to_string() + }; + return crate::conversions::error::to_dafny(native_error_new); + } + } + +} \ No newline at end of file From d5cafd51acf30f24a7815f5b464dafcf0847a8ab Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 14:40:15 -0800 Subject: [PATCH 20/32] nogo --- SmithyDafnyMakefile.mk | 2 +- .../WrappedSimpleExternService/shim.go | 1 + TestModels/OrphanedShapes/README.md | 11 +- .../ExternDefinitions/ExternDefinitions.go | 68 - .../ExternDefinitions/extern.go | 22 - .../ImplementationFromDafny-go.dtr | 20 - .../ImplementationFromDafny.go | 29 - .../OrphanedResource/OrphanedResource.go | 108 - .../SimpleOrphaned/SimpleOrphaned.go | 152 -- .../SimpleOrphanedImpl/SimpleOrphanedImpl.go | 132 -- .../SimpleOrphanedTypes.go | 2046 ----------------- .../WrappedSimpleOrphanedService/shim.go | 23 - .../go/ImplementationFromDafny-go/shim.go | 52 - .../OrphanedResource.go | 25 - .../OrphanedResourceNativeWrapper.go | 23 - .../api_client.go | 24 - .../simpleorphanedsmithygenerated/to_dafny.go | 128 -- .../to_native.go | 156 -- .../enums.go | 19 - .../errors.go | 17 - .../types.go | 177 -- .../unmodelled_errors.go | 26 - .../ExternDefinitions/ExternDefinitions.go | 129 -- .../ExternDefinitions/extern.go | 7 +- .../TestsFromDafny-go/TestsFromDafny-go.dtr | 14 - .../go/TestsFromDafny-go/TestsFromDafny.go | 144 -- .../WrappedSimpleOrphanedService.go | 73 - .../WrappedSimpleOrphanedService/shim.go | 23 - .../WrappedTest/WrappedTest.go | 83 - .../runtimes/go/TestsFromDafny-go/go.sum | 2 - .../runtimes/go/TestsFromDafny-go/shim.go | 52 - .../OrphanedResource.go | 25 - .../OrphanedResourceNativeWrapper.go | 23 - .../api_client.go | 24 - .../simpleorphanedsmithygenerated/to_dafny.go | 128 -- .../to_native.go | 156 -- .../enums.go | 19 - .../errors.go | 17 - .../types.go | 177 -- .../unmodelled_errors.go | 26 - 40 files changed, 11 insertions(+), 4372 deletions(-) delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/ExternDefinitions.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/extern.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/OrphanedResource/OrphanedResource.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphaned/SimpleOrphaned.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedImpl/SimpleOrphanedImpl.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedTypes/SimpleOrphanedTypes.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/WrappedSimpleOrphanedService/shim.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/shim.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/api_client.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_native.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/ExternDefinitions.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny-go.dtr delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/WrappedSimpleOrphanedService.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/shim.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedTest/WrappedTest.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.sum delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/shim.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/api_client.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_native.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go delete mode 100644 TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go diff --git a/SmithyDafnyMakefile.mk b/SmithyDafnyMakefile.mk index 692f994af1..8027e465fa 100644 --- a/SmithyDafnyMakefile.mk +++ b/SmithyDafnyMakefile.mk @@ -336,7 +336,7 @@ _polymorph_dependencies: polymorph_code_gen: POLYMORPH_LANGUAGE_TARGET=code_gen polymorph_code_gen: _polymorph_dependencies polymorph_code_gen: - set -e; for service in $(PROJECT_SERVICES) ; do \go + set -e; for service in $(PROJECT_SERVICES) ; do \ export service_deps_var=SERVICE_DEPS_$${service} ; \ export namespace_var=SERVICE_NAMESPACE_$${service} ; \ export SERVICE=$${service} ; \ diff --git a/TestModels/Extern/runtimes/go/TestsFromDafny-go/WrappedSimpleExternService/shim.go b/TestModels/Extern/runtimes/go/TestsFromDafny-go/WrappedSimpleExternService/shim.go index 32377e6dae..8dc66307da 100644 --- a/TestModels/Extern/runtimes/go/TestsFromDafny-go/WrappedSimpleExternService/shim.go +++ b/TestModels/Extern/runtimes/go/TestsFromDafny-go/WrappedSimpleExternService/shim.go @@ -5,6 +5,7 @@ package WrappedSimpleExternService import ( "context" + "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" "github.com/smithy-lang/smithy-dafny/TestModels/Extern/SimpleDafnyExternTypes" "github.com/smithy-lang/smithy-dafny/TestModels/Extern/simpledafnyexternsmithygenerated" diff --git a/TestModels/OrphanedShapes/README.md b/TestModels/OrphanedShapes/README.md index e1380a1aca..8b27003b0f 100644 --- a/TestModels/OrphanedShapes/README.md +++ b/TestModels/OrphanedShapes/README.md @@ -32,6 +32,7 @@ This TestModel assumes these other TestModels are passing: - Extern - Extendable +- Errors - LocalService - Union - Aggregate @@ -42,13 +43,13 @@ and these TestModels' prerequisite TestModels. ## Coverage This TestModel tests some instances of orphaned shapes -- LocalService Config shapes. These are "orphaned", but are likely already handled as one-offs by any codegen that's this TestModels' prerequisites. +- LocalService Config shapes. (Config shapes are "orphaned", but are likely already handled as one-offs by any codegen that's this TestModels' prerequisites) - Errors - Resources (with @aws.polymorph#reference trait) and their operations - Structures (and structures' members) -The "key" to this TestModel is in the extern implementations. -The externs require passing some orphaned shapes across the Dafny layer. +The bar this TestModel establishes is "if a shape is defined in a Smithy model, its native/Dafny shapes and their conversions are defined in a runtime." + +This TestModel asserts this by requiring externs to pass orphaned shapes across the Dafny layer. The extern implementations MUST call Polymorph-generated native shapes and Dafny/native conversions for these orphaned shapes. -However, Polymorph will only generate these shapes and conversions if the language's codegen supports orphaned shapes. -So if this language generates these conversions, then it supports orphaned shapes. +Polymorph will only generate these shapes and conversions if the language's codegen supports orphaned shapes. diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/ExternDefinitions.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/ExternDefinitions.go deleted file mode 100644 index 34c7f8949b..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/ExternDefinitions.go +++ /dev/null @@ -1,68 +0,0 @@ -// Package ExternDefinitions -// Dafny module ExternDefinitions compiled into Go - -package ExternDefinitions - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" - m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ -var _ m_SimpleOrphanedTypes.Dummy__ -var _ m_OrphanedResource.Dummy__ - -type Dummy__ struct{} - -// Definition of class Default__ -type Default__ struct { - dummy byte -} - -func New_Default___() *Default__ { - _this := Default__{} - - return &_this -} - -type CompanionStruct_Default___ struct { -} - -var Companion_Default___ = CompanionStruct_Default___{} - -func (_this *Default__) Equals(other *Default__) bool { - return _this == other -} - -func (_this *Default__) EqualsGeneric(x interface{}) bool { - other, ok := x.(*Default__) - return ok && _this.Equals(other) -} - -func (*Default__) String() string { - return "ExternDefinitions.Default__" -} -func (_this *Default__) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = &Default__{} - -func (_static *CompanionStruct_Default___) EmptyMethod() { -} - -// End of class Default__ diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/extern.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/extern.go deleted file mode 100644 index 162cf0d358..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ExternDefinitions/extern.go +++ /dev/null @@ -1,22 +0,0 @@ -package ExternDefinitions - -import ( - Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" - SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" -) - -var _ Wrappers.Dummy__ - -func (CompanionStruct_Default___) InitializeOrphanedStructure(input SimpleOrphanedTypes.OrphanedStructure) SimpleOrphanedTypes.OrphanedStructure { - return input -} - -func (CompanionStruct_Default___) CallNativeOrphanedResource(input *OrphanedResource.OrphanedResource) Wrappers.Result { - OrphanedResource_FromDafny(input) - return Wrappers.Result_Success(input) -} - -func (CompanionStruct_Default___) CallNativeOrphanedError(input SimpleOrphanedTypes.Error) SimpleOrphanedTypes.Error { - return input -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr deleted file mode 100644 index 8f4082b933..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny-go.dtr +++ /dev/null @@ -1,20 +0,0 @@ -file_format_version = "1.0" -dafny_version = "4.9.0.0" -[options_by_module.SimpleOrphanedTypes] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" -legacy-module-names = false -[options_by_module.AbstractSimpleOrphanedOperations] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" -legacy-module-names = false -[options_by_module.AbstractSimpleOrphanedService] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" -legacy-module-names = false -[options_by_module.SimpleOrphanedImpl] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" -legacy-module-names = false -[options_by_module.SimpleOrphaned] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" -legacy-module-names = false -[options_by_module.OrphanedResource] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes" -legacy-module-names = false diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny.go deleted file mode 100644 index 888cd717af..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/ImplementationFromDafny.go +++ /dev/null @@ -1,29 +0,0 @@ -// Dafny program the_program compiled into Go -package the_program - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" - m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" - m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" - m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ -var _ m_SimpleOrphanedTypes.Dummy__ -var _ m_SimpleOrphanedImpl.Dummy__ -var _ m_SimpleOrphaned.Dummy__ -var _ m_OrphanedResource.Dummy__ diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/OrphanedResource/OrphanedResource.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/OrphanedResource/OrphanedResource.go deleted file mode 100644 index 02507e8add..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/OrphanedResource/OrphanedResource.go +++ /dev/null @@ -1,108 +0,0 @@ -// Package OrphanedResource -// Dafny module OrphanedResource compiled into Go - -package OrphanedResource - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" - m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" - m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ -var _ m_SimpleOrphanedTypes.Dummy__ -var _ m_SimpleOrphanedImpl.Dummy__ -var _ m_SimpleOrphaned.Dummy__ - -type Dummy__ struct{} - -// Definition of class OrphanedResource -type OrphanedResource struct { - dummy byte -} - -func New_OrphanedResource_() *OrphanedResource { - _this := OrphanedResource{} - - return &_this -} - -type CompanionStruct_OrphanedResource_ struct { -} - -var Companion_OrphanedResource_ = CompanionStruct_OrphanedResource_{} - -func (_this *OrphanedResource) Equals(other *OrphanedResource) bool { - return _this == other -} - -func (_this *OrphanedResource) EqualsGeneric(x interface{}) bool { - other, ok := x.(*OrphanedResource) - return ok && _this.Equals(other) -} - -func (*OrphanedResource) String() string { - return "OrphanedResource.OrphanedResource" -} - -func Type_OrphanedResource_() _dafny.TypeDescriptor { - return type_OrphanedResource_{} -} - -type type_OrphanedResource_ struct { -} - -func (_this type_OrphanedResource_) Default() interface{} { - return (*OrphanedResource)(nil) -} - -func (_this type_OrphanedResource_) String() string { - return "OrphanedResource.OrphanedResource" -} -func (_this *OrphanedResource) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){m_SimpleOrphanedTypes.Companion_IOrphanedResource_.TraitID_} -} - -var _ m_SimpleOrphanedTypes.IOrphanedResource = &OrphanedResource{} -var _ _dafny.TraitOffspring = &OrphanedResource{} - -func (_this *OrphanedResource) OrphanedResourceOperation(input m_SimpleOrphanedTypes.OrphanedResourceOperationInput) m_Wrappers.Result { - var _out1 m_Wrappers.Result - _ = _out1 - _out1 = m_SimpleOrphanedTypes.Companion_IOrphanedResource_.OrphanedResourceOperation(_this, input) - return _out1 -} -func (_this *OrphanedResource) Ctor__() { - { - } -} -func (_this *OrphanedResource) OrphanedResourceOperation_k(input m_SimpleOrphanedTypes.OrphanedResourceOperationInput) m_Wrappers.Result { - { - var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(m_SimpleOrphanedTypes.Companion_OrphanedResourceOperationOutput_.Default()) - _ = output - if (((input).Dtor_someString()).Is_Some()) && (_dafny.Companion_Sequence_.Equal(((input).Dtor_someString()).Dtor_value().(_dafny.Sequence), _dafny.SeqOfString("the extern MUST provide this string to the native resource's operation"))) { - output = m_Wrappers.Companion_Result_.Create_Success_(m_SimpleOrphanedTypes.Companion_OrphanedResourceOperationOutput_.Create_OrphanedResourceOperationOutput_(m_Wrappers.Companion_Option_.Create_Some_(_dafny.SeqOfString("correct string")))) - return output - } else { - output = m_Wrappers.Companion_Result_.Create_Failure_(m_SimpleOrphanedTypes.Companion_Error_.Create_OrphanedError_(_dafny.SeqOfString("incorrect string"))) - return output - } - return output - } -} - -// End of class OrphanedResource diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphaned/SimpleOrphaned.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphaned/SimpleOrphaned.go deleted file mode 100644 index 39ff28a59b..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphaned/SimpleOrphaned.go +++ /dev/null @@ -1,152 +0,0 @@ -// Package SimpleOrphaned -// Dafny module SimpleOrphaned compiled into Go - -package SimpleOrphaned - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" - m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ -var _ m_SimpleOrphanedTypes.Dummy__ -var _ m_SimpleOrphanedImpl.Dummy__ - -type Dummy__ struct{} - -// Definition of class Default__ -type Default__ struct { - dummy byte -} - -func New_Default___() *Default__ { - _this := Default__{} - - return &_this -} - -type CompanionStruct_Default___ struct { -} - -var Companion_Default___ = CompanionStruct_Default___{} - -func (_this *Default__) Equals(other *Default__) bool { - return _this == other -} - -func (_this *Default__) EqualsGeneric(x interface{}) bool { - other, ok := x.(*Default__) - return ok && _this.Equals(other) -} - -func (*Default__) String() string { - return "SimpleOrphaned.Default__" -} -func (_this *Default__) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = &Default__{} - -func (_static *CompanionStruct_Default___) DefaultSimpleOrphanedConfig() m_SimpleOrphanedTypes.SimpleOrphanedConfig { - return m_SimpleOrphanedTypes.Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(m_Wrappers.Companion_Option_.Create_None_()) -} -func (_static *CompanionStruct_Default___) SimpleOrphaned(config m_SimpleOrphanedTypes.SimpleOrphanedConfig) m_Wrappers.Result { - var res m_Wrappers.Result = m_Wrappers.Result{} - _ = res - var _0_client *SimpleOrphanedClient - _ = _0_client - var _nw0 *SimpleOrphanedClient = New_SimpleOrphanedClient_() - _ = _nw0 - _nw0.Ctor__(m_SimpleOrphanedImpl.Companion_Config_.Create_Config_()) - _0_client = _nw0 - res = m_Wrappers.Companion_Result_.Create_Success_(_0_client) - return res - return res -} -func (_static *CompanionStruct_Default___) CreateSuccessOfClient(client m_SimpleOrphanedTypes.ISimpleOrphanedClient) m_Wrappers.Result { - return m_Wrappers.Companion_Result_.Create_Success_(client) -} -func (_static *CompanionStruct_Default___) CreateFailureOfError(error_ m_SimpleOrphanedTypes.Error) m_Wrappers.Result { - return m_Wrappers.Companion_Result_.Create_Failure_(error_) -} - -// End of class Default__ - -// Definition of class SimpleOrphanedClient -type SimpleOrphanedClient struct { - _config m_SimpleOrphanedImpl.Config -} - -func New_SimpleOrphanedClient_() *SimpleOrphanedClient { - _this := SimpleOrphanedClient{} - - _this._config = m_SimpleOrphanedImpl.Companion_Config_.Default() - return &_this -} - -type CompanionStruct_SimpleOrphanedClient_ struct { -} - -var Companion_SimpleOrphanedClient_ = CompanionStruct_SimpleOrphanedClient_{} - -func (_this *SimpleOrphanedClient) Equals(other *SimpleOrphanedClient) bool { - return _this == other -} - -func (_this *SimpleOrphanedClient) EqualsGeneric(x interface{}) bool { - other, ok := x.(*SimpleOrphanedClient) - return ok && _this.Equals(other) -} - -func (*SimpleOrphanedClient) String() string { - return "SimpleOrphaned.SimpleOrphanedClient" -} - -func Type_SimpleOrphanedClient_() _dafny.TypeDescriptor { - return type_SimpleOrphanedClient_{} -} - -type type_SimpleOrphanedClient_ struct { -} - -func (_this type_SimpleOrphanedClient_) Default() interface{} { - return (*SimpleOrphanedClient)(nil) -} - -func (_this type_SimpleOrphanedClient_) String() string { - return "SimpleOrphaned.SimpleOrphanedClient" -} -func (_this *SimpleOrphanedClient) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){m_SimpleOrphanedTypes.Companion_ISimpleOrphanedClient_.TraitID_} -} - -var _ m_SimpleOrphanedTypes.ISimpleOrphanedClient = &SimpleOrphanedClient{} -var _ _dafny.TraitOffspring = &SimpleOrphanedClient{} - -func (_this *SimpleOrphanedClient) Ctor__(config m_SimpleOrphanedImpl.Config) { - { - (_this)._config = config - } -} -func (_this *SimpleOrphanedClient) Config() m_SimpleOrphanedImpl.Config { - { - return _this._config - } -} - -// End of class SimpleOrphanedClient diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedImpl/SimpleOrphanedImpl.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedImpl/SimpleOrphanedImpl.go deleted file mode 100644 index db3f825674..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedImpl/SimpleOrphanedImpl.go +++ /dev/null @@ -1,132 +0,0 @@ -// Package SimpleOrphanedImpl -// Dafny module SimpleOrphanedImpl compiled into Go - -package SimpleOrphanedImpl - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ -var _ m_SimpleOrphanedTypes.Dummy__ - -type Dummy__ struct{} - -// Definition of datatype Config -type Config struct { - Data_Config_ -} - -func (_this Config) Get_() Data_Config_ { - return _this.Data_Config_ -} - -type Data_Config_ interface { - isConfig() -} - -type CompanionStruct_Config_ struct { -} - -var Companion_Config_ = CompanionStruct_Config_{} - -type Config_Config struct { -} - -func (Config_Config) isConfig() {} - -func (CompanionStruct_Config_) Create_Config_() Config { - return Config{Config_Config{}} -} - -func (_this Config) Is_Config() bool { - _, ok := _this.Get_().(Config_Config) - return ok -} - -func (CompanionStruct_Config_) Default() Config { - return Companion_Config_.Create_Config_() -} - -func (_ CompanionStruct_Config_) AllSingletonConstructors() _dafny.Iterator { - i := -1 - return func() (interface{}, bool) { - i++ - switch i { - case 0: - return Companion_Config_.Create_Config_(), true - default: - return Config{}, false - } - } -} - -func (_this Config) String() string { - switch _this.Get_().(type) { - case nil: - return "null" - case Config_Config: - { - return "SimpleOrphanedImpl.Config.Config" - } - default: - { - return "" - } - } -} - -func (_this Config) Equals(other Config) bool { - switch _this.Get_().(type) { - case Config_Config: - { - _, ok := other.Get_().(Config_Config) - return ok - } - default: - { - return false // unexpected - } - } -} - -func (_this Config) EqualsGeneric(other interface{}) bool { - typed, ok := other.(Config) - return ok && _this.Equals(typed) -} - -func Type_Config_() _dafny.TypeDescriptor { - return type_Config_{} -} - -type type_Config_ struct { -} - -func (_this type_Config_) Default() interface{} { - return Companion_Config_.Default() -} - -func (_this type_Config_) String() string { - return "SimpleOrphanedImpl.Config" -} -func (_this Config) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = Config{} - -// End of datatype Config diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedTypes/SimpleOrphanedTypes.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedTypes/SimpleOrphanedTypes.go deleted file mode 100644 index 1030b8c0e6..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/SimpleOrphanedTypes/SimpleOrphanedTypes.go +++ /dev/null @@ -1,2046 +0,0 @@ -// Package SimpleOrphanedTypes -// Dafny module SimpleOrphanedTypes compiled into Go - -package SimpleOrphanedTypes - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ - -type Dummy__ struct{} - -// Definition of class Default__ -type Default__ struct { - dummy byte -} - -func New_Default___() *Default__ { - _this := Default__{} - - return &_this -} - -type CompanionStruct_Default___ struct { -} - -var Companion_Default___ = CompanionStruct_Default___{} - -func (_this *Default__) Equals(other *Default__) bool { - return _this == other -} - -func (_this *Default__) EqualsGeneric(x interface{}) bool { - other, ok := x.(*Default__) - return ok && _this.Equals(other) -} - -func (*Default__) String() string { - return "SimpleOrphanedTypes.Default__" -} -func (_this *Default__) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = &Default__{} - -func (_static *CompanionStruct_Default___) IsDummySubsetType(x _dafny.Int) bool { - return (x).Sign() == 1 -} - -// End of class Default__ - -// Definition of datatype DafnyCallEvent -type DafnyCallEvent struct { - Data_DafnyCallEvent_ -} - -func (_this DafnyCallEvent) Get_() Data_DafnyCallEvent_ { - return _this.Data_DafnyCallEvent_ -} - -type Data_DafnyCallEvent_ interface { - isDafnyCallEvent() -} - -type CompanionStruct_DafnyCallEvent_ struct { -} - -var Companion_DafnyCallEvent_ = CompanionStruct_DafnyCallEvent_{} - -type DafnyCallEvent_DafnyCallEvent struct { - Input interface{} - Output interface{} -} - -func (DafnyCallEvent_DafnyCallEvent) isDafnyCallEvent() {} - -func (CompanionStruct_DafnyCallEvent_) Create_DafnyCallEvent_(Input interface{}, Output interface{}) DafnyCallEvent { - return DafnyCallEvent{DafnyCallEvent_DafnyCallEvent{Input, Output}} -} - -func (_this DafnyCallEvent) Is_DafnyCallEvent() bool { - _, ok := _this.Get_().(DafnyCallEvent_DafnyCallEvent) - return ok -} - -func (CompanionStruct_DafnyCallEvent_) Default(_default_I interface{}, _default_O interface{}) DafnyCallEvent { - return Companion_DafnyCallEvent_.Create_DafnyCallEvent_(_default_I, _default_O) -} - -func (_this DafnyCallEvent) Dtor_input() interface{} { - return _this.Get_().(DafnyCallEvent_DafnyCallEvent).Input -} - -func (_this DafnyCallEvent) Dtor_output() interface{} { - return _this.Get_().(DafnyCallEvent_DafnyCallEvent).Output -} - -func (_this DafnyCallEvent) String() string { - switch data := _this.Get_().(type) { - case nil: - return "null" - case DafnyCallEvent_DafnyCallEvent: - { - return "SimpleOrphanedTypes.DafnyCallEvent.DafnyCallEvent" + "(" + _dafny.String(data.Input) + ", " + _dafny.String(data.Output) + ")" - } - default: - { - return "" - } - } -} - -func (_this DafnyCallEvent) Equals(other DafnyCallEvent) bool { - switch data1 := _this.Get_().(type) { - case DafnyCallEvent_DafnyCallEvent: - { - data2, ok := other.Get_().(DafnyCallEvent_DafnyCallEvent) - return ok && _dafny.AreEqual(data1.Input, data2.Input) && _dafny.AreEqual(data1.Output, data2.Output) - } - default: - { - return false // unexpected - } - } -} - -func (_this DafnyCallEvent) EqualsGeneric(other interface{}) bool { - typed, ok := other.(DafnyCallEvent) - return ok && _this.Equals(typed) -} - -func Type_DafnyCallEvent_(Type_I_ _dafny.TypeDescriptor, Type_O_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { - return type_DafnyCallEvent_{Type_I_, Type_O_} -} - -type type_DafnyCallEvent_ struct { - Type_I_ _dafny.TypeDescriptor - Type_O_ _dafny.TypeDescriptor -} - -func (_this type_DafnyCallEvent_) Default() interface{} { - Type_I_ := _this.Type_I_ - _ = Type_I_ - Type_O_ := _this.Type_O_ - _ = Type_O_ - return Companion_DafnyCallEvent_.Default(Type_I_.Default(), Type_O_.Default()) -} - -func (_this type_DafnyCallEvent_) String() string { - return "SimpleOrphanedTypes.DafnyCallEvent" -} -func (_this DafnyCallEvent) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = DafnyCallEvent{} - -// End of datatype DafnyCallEvent - -// Definition of datatype CreateOrphanedErrorInput -type CreateOrphanedErrorInput struct { - Data_CreateOrphanedErrorInput_ -} - -func (_this CreateOrphanedErrorInput) Get_() Data_CreateOrphanedErrorInput_ { - return _this.Data_CreateOrphanedErrorInput_ -} - -type Data_CreateOrphanedErrorInput_ interface { - isCreateOrphanedErrorInput() -} - -type CompanionStruct_CreateOrphanedErrorInput_ struct { -} - -var Companion_CreateOrphanedErrorInput_ = CompanionStruct_CreateOrphanedErrorInput_{} - -type CreateOrphanedErrorInput_CreateOrphanedErrorInput struct { -} - -func (CreateOrphanedErrorInput_CreateOrphanedErrorInput) isCreateOrphanedErrorInput() {} - -func (CompanionStruct_CreateOrphanedErrorInput_) Create_CreateOrphanedErrorInput_() CreateOrphanedErrorInput { - return CreateOrphanedErrorInput{CreateOrphanedErrorInput_CreateOrphanedErrorInput{}} -} - -func (_this CreateOrphanedErrorInput) Is_CreateOrphanedErrorInput() bool { - _, ok := _this.Get_().(CreateOrphanedErrorInput_CreateOrphanedErrorInput) - return ok -} - -func (CompanionStruct_CreateOrphanedErrorInput_) Default() CreateOrphanedErrorInput { - return Companion_CreateOrphanedErrorInput_.Create_CreateOrphanedErrorInput_() -} - -func (_ CompanionStruct_CreateOrphanedErrorInput_) AllSingletonConstructors() _dafny.Iterator { - i := -1 - return func() (interface{}, bool) { - i++ - switch i { - case 0: - return Companion_CreateOrphanedErrorInput_.Create_CreateOrphanedErrorInput_(), true - default: - return CreateOrphanedErrorInput{}, false - } - } -} - -func (_this CreateOrphanedErrorInput) String() string { - switch _this.Get_().(type) { - case nil: - return "null" - case CreateOrphanedErrorInput_CreateOrphanedErrorInput: - { - return "SimpleOrphanedTypes.CreateOrphanedErrorInput.CreateOrphanedErrorInput" - } - default: - { - return "" - } - } -} - -func (_this CreateOrphanedErrorInput) Equals(other CreateOrphanedErrorInput) bool { - switch _this.Get_().(type) { - case CreateOrphanedErrorInput_CreateOrphanedErrorInput: - { - _, ok := other.Get_().(CreateOrphanedErrorInput_CreateOrphanedErrorInput) - return ok - } - default: - { - return false // unexpected - } - } -} - -func (_this CreateOrphanedErrorInput) EqualsGeneric(other interface{}) bool { - typed, ok := other.(CreateOrphanedErrorInput) - return ok && _this.Equals(typed) -} - -func Type_CreateOrphanedErrorInput_() _dafny.TypeDescriptor { - return type_CreateOrphanedErrorInput_{} -} - -type type_CreateOrphanedErrorInput_ struct { -} - -func (_this type_CreateOrphanedErrorInput_) Default() interface{} { - return Companion_CreateOrphanedErrorInput_.Default() -} - -func (_this type_CreateOrphanedErrorInput_) String() string { - return "SimpleOrphanedTypes.CreateOrphanedErrorInput" -} -func (_this CreateOrphanedErrorInput) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = CreateOrphanedErrorInput{} - -// End of datatype CreateOrphanedErrorInput - -// Definition of datatype CreateOrphanedErrorOutput -type CreateOrphanedErrorOutput struct { - Data_CreateOrphanedErrorOutput_ -} - -func (_this CreateOrphanedErrorOutput) Get_() Data_CreateOrphanedErrorOutput_ { - return _this.Data_CreateOrphanedErrorOutput_ -} - -type Data_CreateOrphanedErrorOutput_ interface { - isCreateOrphanedErrorOutput() -} - -type CompanionStruct_CreateOrphanedErrorOutput_ struct { -} - -var Companion_CreateOrphanedErrorOutput_ = CompanionStruct_CreateOrphanedErrorOutput_{} - -type CreateOrphanedErrorOutput_CreateOrphanedErrorOutput struct { -} - -func (CreateOrphanedErrorOutput_CreateOrphanedErrorOutput) isCreateOrphanedErrorOutput() {} - -func (CompanionStruct_CreateOrphanedErrorOutput_) Create_CreateOrphanedErrorOutput_() CreateOrphanedErrorOutput { - return CreateOrphanedErrorOutput{CreateOrphanedErrorOutput_CreateOrphanedErrorOutput{}} -} - -func (_this CreateOrphanedErrorOutput) Is_CreateOrphanedErrorOutput() bool { - _, ok := _this.Get_().(CreateOrphanedErrorOutput_CreateOrphanedErrorOutput) - return ok -} - -func (CompanionStruct_CreateOrphanedErrorOutput_) Default() CreateOrphanedErrorOutput { - return Companion_CreateOrphanedErrorOutput_.Create_CreateOrphanedErrorOutput_() -} - -func (_ CompanionStruct_CreateOrphanedErrorOutput_) AllSingletonConstructors() _dafny.Iterator { - i := -1 - return func() (interface{}, bool) { - i++ - switch i { - case 0: - return Companion_CreateOrphanedErrorOutput_.Create_CreateOrphanedErrorOutput_(), true - default: - return CreateOrphanedErrorOutput{}, false - } - } -} - -func (_this CreateOrphanedErrorOutput) String() string { - switch _this.Get_().(type) { - case nil: - return "null" - case CreateOrphanedErrorOutput_CreateOrphanedErrorOutput: - { - return "SimpleOrphanedTypes.CreateOrphanedErrorOutput.CreateOrphanedErrorOutput" - } - default: - { - return "" - } - } -} - -func (_this CreateOrphanedErrorOutput) Equals(other CreateOrphanedErrorOutput) bool { - switch _this.Get_().(type) { - case CreateOrphanedErrorOutput_CreateOrphanedErrorOutput: - { - _, ok := other.Get_().(CreateOrphanedErrorOutput_CreateOrphanedErrorOutput) - return ok - } - default: - { - return false // unexpected - } - } -} - -func (_this CreateOrphanedErrorOutput) EqualsGeneric(other interface{}) bool { - typed, ok := other.(CreateOrphanedErrorOutput) - return ok && _this.Equals(typed) -} - -func Type_CreateOrphanedErrorOutput_() _dafny.TypeDescriptor { - return type_CreateOrphanedErrorOutput_{} -} - -type type_CreateOrphanedErrorOutput_ struct { -} - -func (_this type_CreateOrphanedErrorOutput_) Default() interface{} { - return Companion_CreateOrphanedErrorOutput_.Default() -} - -func (_this type_CreateOrphanedErrorOutput_) String() string { - return "SimpleOrphanedTypes.CreateOrphanedErrorOutput" -} -func (_this CreateOrphanedErrorOutput) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = CreateOrphanedErrorOutput{} - -// End of datatype CreateOrphanedErrorOutput - -// Definition of datatype CreateOrphanedResourceInput -type CreateOrphanedResourceInput struct { - Data_CreateOrphanedResourceInput_ -} - -func (_this CreateOrphanedResourceInput) Get_() Data_CreateOrphanedResourceInput_ { - return _this.Data_CreateOrphanedResourceInput_ -} - -type Data_CreateOrphanedResourceInput_ interface { - isCreateOrphanedResourceInput() -} - -type CompanionStruct_CreateOrphanedResourceInput_ struct { -} - -var Companion_CreateOrphanedResourceInput_ = CompanionStruct_CreateOrphanedResourceInput_{} - -type CreateOrphanedResourceInput_CreateOrphanedResourceInput struct { -} - -func (CreateOrphanedResourceInput_CreateOrphanedResourceInput) isCreateOrphanedResourceInput() {} - -func (CompanionStruct_CreateOrphanedResourceInput_) Create_CreateOrphanedResourceInput_() CreateOrphanedResourceInput { - return CreateOrphanedResourceInput{CreateOrphanedResourceInput_CreateOrphanedResourceInput{}} -} - -func (_this CreateOrphanedResourceInput) Is_CreateOrphanedResourceInput() bool { - _, ok := _this.Get_().(CreateOrphanedResourceInput_CreateOrphanedResourceInput) - return ok -} - -func (CompanionStruct_CreateOrphanedResourceInput_) Default() CreateOrphanedResourceInput { - return Companion_CreateOrphanedResourceInput_.Create_CreateOrphanedResourceInput_() -} - -func (_ CompanionStruct_CreateOrphanedResourceInput_) AllSingletonConstructors() _dafny.Iterator { - i := -1 - return func() (interface{}, bool) { - i++ - switch i { - case 0: - return Companion_CreateOrphanedResourceInput_.Create_CreateOrphanedResourceInput_(), true - default: - return CreateOrphanedResourceInput{}, false - } - } -} - -func (_this CreateOrphanedResourceInput) String() string { - switch _this.Get_().(type) { - case nil: - return "null" - case CreateOrphanedResourceInput_CreateOrphanedResourceInput: - { - return "SimpleOrphanedTypes.CreateOrphanedResourceInput.CreateOrphanedResourceInput" - } - default: - { - return "" - } - } -} - -func (_this CreateOrphanedResourceInput) Equals(other CreateOrphanedResourceInput) bool { - switch _this.Get_().(type) { - case CreateOrphanedResourceInput_CreateOrphanedResourceInput: - { - _, ok := other.Get_().(CreateOrphanedResourceInput_CreateOrphanedResourceInput) - return ok - } - default: - { - return false // unexpected - } - } -} - -func (_this CreateOrphanedResourceInput) EqualsGeneric(other interface{}) bool { - typed, ok := other.(CreateOrphanedResourceInput) - return ok && _this.Equals(typed) -} - -func Type_CreateOrphanedResourceInput_() _dafny.TypeDescriptor { - return type_CreateOrphanedResourceInput_{} -} - -type type_CreateOrphanedResourceInput_ struct { -} - -func (_this type_CreateOrphanedResourceInput_) Default() interface{} { - return Companion_CreateOrphanedResourceInput_.Default() -} - -func (_this type_CreateOrphanedResourceInput_) String() string { - return "SimpleOrphanedTypes.CreateOrphanedResourceInput" -} -func (_this CreateOrphanedResourceInput) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = CreateOrphanedResourceInput{} - -// End of datatype CreateOrphanedResourceInput - -// Definition of datatype CreateOrphanedResourceOutput -type CreateOrphanedResourceOutput struct { - Data_CreateOrphanedResourceOutput_ -} - -func (_this CreateOrphanedResourceOutput) Get_() Data_CreateOrphanedResourceOutput_ { - return _this.Data_CreateOrphanedResourceOutput_ -} - -type Data_CreateOrphanedResourceOutput_ interface { - isCreateOrphanedResourceOutput() -} - -type CompanionStruct_CreateOrphanedResourceOutput_ struct { -} - -var Companion_CreateOrphanedResourceOutput_ = CompanionStruct_CreateOrphanedResourceOutput_{} - -type CreateOrphanedResourceOutput_CreateOrphanedResourceOutput struct { -} - -func (CreateOrphanedResourceOutput_CreateOrphanedResourceOutput) isCreateOrphanedResourceOutput() {} - -func (CompanionStruct_CreateOrphanedResourceOutput_) Create_CreateOrphanedResourceOutput_() CreateOrphanedResourceOutput { - return CreateOrphanedResourceOutput{CreateOrphanedResourceOutput_CreateOrphanedResourceOutput{}} -} - -func (_this CreateOrphanedResourceOutput) Is_CreateOrphanedResourceOutput() bool { - _, ok := _this.Get_().(CreateOrphanedResourceOutput_CreateOrphanedResourceOutput) - return ok -} - -func (CompanionStruct_CreateOrphanedResourceOutput_) Default() CreateOrphanedResourceOutput { - return Companion_CreateOrphanedResourceOutput_.Create_CreateOrphanedResourceOutput_() -} - -func (_ CompanionStruct_CreateOrphanedResourceOutput_) AllSingletonConstructors() _dafny.Iterator { - i := -1 - return func() (interface{}, bool) { - i++ - switch i { - case 0: - return Companion_CreateOrphanedResourceOutput_.Create_CreateOrphanedResourceOutput_(), true - default: - return CreateOrphanedResourceOutput{}, false - } - } -} - -func (_this CreateOrphanedResourceOutput) String() string { - switch _this.Get_().(type) { - case nil: - return "null" - case CreateOrphanedResourceOutput_CreateOrphanedResourceOutput: - { - return "SimpleOrphanedTypes.CreateOrphanedResourceOutput.CreateOrphanedResourceOutput" - } - default: - { - return "" - } - } -} - -func (_this CreateOrphanedResourceOutput) Equals(other CreateOrphanedResourceOutput) bool { - switch _this.Get_().(type) { - case CreateOrphanedResourceOutput_CreateOrphanedResourceOutput: - { - _, ok := other.Get_().(CreateOrphanedResourceOutput_CreateOrphanedResourceOutput) - return ok - } - default: - { - return false // unexpected - } - } -} - -func (_this CreateOrphanedResourceOutput) EqualsGeneric(other interface{}) bool { - typed, ok := other.(CreateOrphanedResourceOutput) - return ok && _this.Equals(typed) -} - -func Type_CreateOrphanedResourceOutput_() _dafny.TypeDescriptor { - return type_CreateOrphanedResourceOutput_{} -} - -type type_CreateOrphanedResourceOutput_ struct { -} - -func (_this type_CreateOrphanedResourceOutput_) Default() interface{} { - return Companion_CreateOrphanedResourceOutput_.Default() -} - -func (_this type_CreateOrphanedResourceOutput_) String() string { - return "SimpleOrphanedTypes.CreateOrphanedResourceOutput" -} -func (_this CreateOrphanedResourceOutput) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = CreateOrphanedResourceOutput{} - -// End of datatype CreateOrphanedResourceOutput - -// Definition of datatype CreateOrphanedStructureInput -type CreateOrphanedStructureInput struct { - Data_CreateOrphanedStructureInput_ -} - -func (_this CreateOrphanedStructureInput) Get_() Data_CreateOrphanedStructureInput_ { - return _this.Data_CreateOrphanedStructureInput_ -} - -type Data_CreateOrphanedStructureInput_ interface { - isCreateOrphanedStructureInput() -} - -type CompanionStruct_CreateOrphanedStructureInput_ struct { -} - -var Companion_CreateOrphanedStructureInput_ = CompanionStruct_CreateOrphanedStructureInput_{} - -type CreateOrphanedStructureInput_CreateOrphanedStructureInput struct { -} - -func (CreateOrphanedStructureInput_CreateOrphanedStructureInput) isCreateOrphanedStructureInput() {} - -func (CompanionStruct_CreateOrphanedStructureInput_) Create_CreateOrphanedStructureInput_() CreateOrphanedStructureInput { - return CreateOrphanedStructureInput{CreateOrphanedStructureInput_CreateOrphanedStructureInput{}} -} - -func (_this CreateOrphanedStructureInput) Is_CreateOrphanedStructureInput() bool { - _, ok := _this.Get_().(CreateOrphanedStructureInput_CreateOrphanedStructureInput) - return ok -} - -func (CompanionStruct_CreateOrphanedStructureInput_) Default() CreateOrphanedStructureInput { - return Companion_CreateOrphanedStructureInput_.Create_CreateOrphanedStructureInput_() -} - -func (_ CompanionStruct_CreateOrphanedStructureInput_) AllSingletonConstructors() _dafny.Iterator { - i := -1 - return func() (interface{}, bool) { - i++ - switch i { - case 0: - return Companion_CreateOrphanedStructureInput_.Create_CreateOrphanedStructureInput_(), true - default: - return CreateOrphanedStructureInput{}, false - } - } -} - -func (_this CreateOrphanedStructureInput) String() string { - switch _this.Get_().(type) { - case nil: - return "null" - case CreateOrphanedStructureInput_CreateOrphanedStructureInput: - { - return "SimpleOrphanedTypes.CreateOrphanedStructureInput.CreateOrphanedStructureInput" - } - default: - { - return "" - } - } -} - -func (_this CreateOrphanedStructureInput) Equals(other CreateOrphanedStructureInput) bool { - switch _this.Get_().(type) { - case CreateOrphanedStructureInput_CreateOrphanedStructureInput: - { - _, ok := other.Get_().(CreateOrphanedStructureInput_CreateOrphanedStructureInput) - return ok - } - default: - { - return false // unexpected - } - } -} - -func (_this CreateOrphanedStructureInput) EqualsGeneric(other interface{}) bool { - typed, ok := other.(CreateOrphanedStructureInput) - return ok && _this.Equals(typed) -} - -func Type_CreateOrphanedStructureInput_() _dafny.TypeDescriptor { - return type_CreateOrphanedStructureInput_{} -} - -type type_CreateOrphanedStructureInput_ struct { -} - -func (_this type_CreateOrphanedStructureInput_) Default() interface{} { - return Companion_CreateOrphanedStructureInput_.Default() -} - -func (_this type_CreateOrphanedStructureInput_) String() string { - return "SimpleOrphanedTypes.CreateOrphanedStructureInput" -} -func (_this CreateOrphanedStructureInput) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = CreateOrphanedStructureInput{} - -// End of datatype CreateOrphanedStructureInput - -// Definition of datatype CreateOrphanedStructureOutput -type CreateOrphanedStructureOutput struct { - Data_CreateOrphanedStructureOutput_ -} - -func (_this CreateOrphanedStructureOutput) Get_() Data_CreateOrphanedStructureOutput_ { - return _this.Data_CreateOrphanedStructureOutput_ -} - -type Data_CreateOrphanedStructureOutput_ interface { - isCreateOrphanedStructureOutput() -} - -type CompanionStruct_CreateOrphanedStructureOutput_ struct { -} - -var Companion_CreateOrphanedStructureOutput_ = CompanionStruct_CreateOrphanedStructureOutput_{} - -type CreateOrphanedStructureOutput_CreateOrphanedStructureOutput struct { -} - -func (CreateOrphanedStructureOutput_CreateOrphanedStructureOutput) isCreateOrphanedStructureOutput() { -} - -func (CompanionStruct_CreateOrphanedStructureOutput_) Create_CreateOrphanedStructureOutput_() CreateOrphanedStructureOutput { - return CreateOrphanedStructureOutput{CreateOrphanedStructureOutput_CreateOrphanedStructureOutput{}} -} - -func (_this CreateOrphanedStructureOutput) Is_CreateOrphanedStructureOutput() bool { - _, ok := _this.Get_().(CreateOrphanedStructureOutput_CreateOrphanedStructureOutput) - return ok -} - -func (CompanionStruct_CreateOrphanedStructureOutput_) Default() CreateOrphanedStructureOutput { - return Companion_CreateOrphanedStructureOutput_.Create_CreateOrphanedStructureOutput_() -} - -func (_ CompanionStruct_CreateOrphanedStructureOutput_) AllSingletonConstructors() _dafny.Iterator { - i := -1 - return func() (interface{}, bool) { - i++ - switch i { - case 0: - return Companion_CreateOrphanedStructureOutput_.Create_CreateOrphanedStructureOutput_(), true - default: - return CreateOrphanedStructureOutput{}, false - } - } -} - -func (_this CreateOrphanedStructureOutput) String() string { - switch _this.Get_().(type) { - case nil: - return "null" - case CreateOrphanedStructureOutput_CreateOrphanedStructureOutput: - { - return "SimpleOrphanedTypes.CreateOrphanedStructureOutput.CreateOrphanedStructureOutput" - } - default: - { - return "" - } - } -} - -func (_this CreateOrphanedStructureOutput) Equals(other CreateOrphanedStructureOutput) bool { - switch _this.Get_().(type) { - case CreateOrphanedStructureOutput_CreateOrphanedStructureOutput: - { - _, ok := other.Get_().(CreateOrphanedStructureOutput_CreateOrphanedStructureOutput) - return ok - } - default: - { - return false // unexpected - } - } -} - -func (_this CreateOrphanedStructureOutput) EqualsGeneric(other interface{}) bool { - typed, ok := other.(CreateOrphanedStructureOutput) - return ok && _this.Equals(typed) -} - -func Type_CreateOrphanedStructureOutput_() _dafny.TypeDescriptor { - return type_CreateOrphanedStructureOutput_{} -} - -type type_CreateOrphanedStructureOutput_ struct { -} - -func (_this type_CreateOrphanedStructureOutput_) Default() interface{} { - return Companion_CreateOrphanedStructureOutput_.Default() -} - -func (_this type_CreateOrphanedStructureOutput_) String() string { - return "SimpleOrphanedTypes.CreateOrphanedStructureOutput" -} -func (_this CreateOrphanedStructureOutput) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = CreateOrphanedStructureOutput{} - -// End of datatype CreateOrphanedStructureOutput - -// Definition of datatype OrphanedConfigShape -type OrphanedConfigShape struct { - Data_OrphanedConfigShape_ -} - -func (_this OrphanedConfigShape) Get_() Data_OrphanedConfigShape_ { - return _this.Data_OrphanedConfigShape_ -} - -type Data_OrphanedConfigShape_ interface { - isOrphanedConfigShape() -} - -type CompanionStruct_OrphanedConfigShape_ struct { -} - -var Companion_OrphanedConfigShape_ = CompanionStruct_OrphanedConfigShape_{} - -type OrphanedConfigShape_OrphanedConfigShape struct { - StringMember m_Wrappers.Option -} - -func (OrphanedConfigShape_OrphanedConfigShape) isOrphanedConfigShape() {} - -func (CompanionStruct_OrphanedConfigShape_) Create_OrphanedConfigShape_(StringMember m_Wrappers.Option) OrphanedConfigShape { - return OrphanedConfigShape{OrphanedConfigShape_OrphanedConfigShape{StringMember}} -} - -func (_this OrphanedConfigShape) Is_OrphanedConfigShape() bool { - _, ok := _this.Get_().(OrphanedConfigShape_OrphanedConfigShape) - return ok -} - -func (CompanionStruct_OrphanedConfigShape_) Default() OrphanedConfigShape { - return Companion_OrphanedConfigShape_.Create_OrphanedConfigShape_(m_Wrappers.Companion_Option_.Default()) -} - -func (_this OrphanedConfigShape) Dtor_stringMember() m_Wrappers.Option { - return _this.Get_().(OrphanedConfigShape_OrphanedConfigShape).StringMember -} - -func (_this OrphanedConfigShape) String() string { - switch data := _this.Get_().(type) { - case nil: - return "null" - case OrphanedConfigShape_OrphanedConfigShape: - { - return "SimpleOrphanedTypes.OrphanedConfigShape.OrphanedConfigShape" + "(" + _dafny.String(data.StringMember) + ")" - } - default: - { - return "" - } - } -} - -func (_this OrphanedConfigShape) Equals(other OrphanedConfigShape) bool { - switch data1 := _this.Get_().(type) { - case OrphanedConfigShape_OrphanedConfigShape: - { - data2, ok := other.Get_().(OrphanedConfigShape_OrphanedConfigShape) - return ok && data1.StringMember.Equals(data2.StringMember) - } - default: - { - return false // unexpected - } - } -} - -func (_this OrphanedConfigShape) EqualsGeneric(other interface{}) bool { - typed, ok := other.(OrphanedConfigShape) - return ok && _this.Equals(typed) -} - -func Type_OrphanedConfigShape_() _dafny.TypeDescriptor { - return type_OrphanedConfigShape_{} -} - -type type_OrphanedConfigShape_ struct { -} - -func (_this type_OrphanedConfigShape_) Default() interface{} { - return Companion_OrphanedConfigShape_.Default() -} - -func (_this type_OrphanedConfigShape_) String() string { - return "SimpleOrphanedTypes.OrphanedConfigShape" -} -func (_this OrphanedConfigShape) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = OrphanedConfigShape{} - -// End of datatype OrphanedConfigShape - -// Definition of datatype OrphanedResourceOperationInput -type OrphanedResourceOperationInput struct { - Data_OrphanedResourceOperationInput_ -} - -func (_this OrphanedResourceOperationInput) Get_() Data_OrphanedResourceOperationInput_ { - return _this.Data_OrphanedResourceOperationInput_ -} - -type Data_OrphanedResourceOperationInput_ interface { - isOrphanedResourceOperationInput() -} - -type CompanionStruct_OrphanedResourceOperationInput_ struct { -} - -var Companion_OrphanedResourceOperationInput_ = CompanionStruct_OrphanedResourceOperationInput_{} - -type OrphanedResourceOperationInput_OrphanedResourceOperationInput struct { - SomeString m_Wrappers.Option -} - -func (OrphanedResourceOperationInput_OrphanedResourceOperationInput) isOrphanedResourceOperationInput() { -} - -func (CompanionStruct_OrphanedResourceOperationInput_) Create_OrphanedResourceOperationInput_(SomeString m_Wrappers.Option) OrphanedResourceOperationInput { - return OrphanedResourceOperationInput{OrphanedResourceOperationInput_OrphanedResourceOperationInput{SomeString}} -} - -func (_this OrphanedResourceOperationInput) Is_OrphanedResourceOperationInput() bool { - _, ok := _this.Get_().(OrphanedResourceOperationInput_OrphanedResourceOperationInput) - return ok -} - -func (CompanionStruct_OrphanedResourceOperationInput_) Default() OrphanedResourceOperationInput { - return Companion_OrphanedResourceOperationInput_.Create_OrphanedResourceOperationInput_(m_Wrappers.Companion_Option_.Default()) -} - -func (_this OrphanedResourceOperationInput) Dtor_someString() m_Wrappers.Option { - return _this.Get_().(OrphanedResourceOperationInput_OrphanedResourceOperationInput).SomeString -} - -func (_this OrphanedResourceOperationInput) String() string { - switch data := _this.Get_().(type) { - case nil: - return "null" - case OrphanedResourceOperationInput_OrphanedResourceOperationInput: - { - return "SimpleOrphanedTypes.OrphanedResourceOperationInput.OrphanedResourceOperationInput" + "(" + _dafny.String(data.SomeString) + ")" - } - default: - { - return "" - } - } -} - -func (_this OrphanedResourceOperationInput) Equals(other OrphanedResourceOperationInput) bool { - switch data1 := _this.Get_().(type) { - case OrphanedResourceOperationInput_OrphanedResourceOperationInput: - { - data2, ok := other.Get_().(OrphanedResourceOperationInput_OrphanedResourceOperationInput) - return ok && data1.SomeString.Equals(data2.SomeString) - } - default: - { - return false // unexpected - } - } -} - -func (_this OrphanedResourceOperationInput) EqualsGeneric(other interface{}) bool { - typed, ok := other.(OrphanedResourceOperationInput) - return ok && _this.Equals(typed) -} - -func Type_OrphanedResourceOperationInput_() _dafny.TypeDescriptor { - return type_OrphanedResourceOperationInput_{} -} - -type type_OrphanedResourceOperationInput_ struct { -} - -func (_this type_OrphanedResourceOperationInput_) Default() interface{} { - return Companion_OrphanedResourceOperationInput_.Default() -} - -func (_this type_OrphanedResourceOperationInput_) String() string { - return "SimpleOrphanedTypes.OrphanedResourceOperationInput" -} -func (_this OrphanedResourceOperationInput) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = OrphanedResourceOperationInput{} - -// End of datatype OrphanedResourceOperationInput - -// Definition of datatype OrphanedResourceOperationOutput -type OrphanedResourceOperationOutput struct { - Data_OrphanedResourceOperationOutput_ -} - -func (_this OrphanedResourceOperationOutput) Get_() Data_OrphanedResourceOperationOutput_ { - return _this.Data_OrphanedResourceOperationOutput_ -} - -type Data_OrphanedResourceOperationOutput_ interface { - isOrphanedResourceOperationOutput() -} - -type CompanionStruct_OrphanedResourceOperationOutput_ struct { -} - -var Companion_OrphanedResourceOperationOutput_ = CompanionStruct_OrphanedResourceOperationOutput_{} - -type OrphanedResourceOperationOutput_OrphanedResourceOperationOutput struct { - SomeString m_Wrappers.Option -} - -func (OrphanedResourceOperationOutput_OrphanedResourceOperationOutput) isOrphanedResourceOperationOutput() { -} - -func (CompanionStruct_OrphanedResourceOperationOutput_) Create_OrphanedResourceOperationOutput_(SomeString m_Wrappers.Option) OrphanedResourceOperationOutput { - return OrphanedResourceOperationOutput{OrphanedResourceOperationOutput_OrphanedResourceOperationOutput{SomeString}} -} - -func (_this OrphanedResourceOperationOutput) Is_OrphanedResourceOperationOutput() bool { - _, ok := _this.Get_().(OrphanedResourceOperationOutput_OrphanedResourceOperationOutput) - return ok -} - -func (CompanionStruct_OrphanedResourceOperationOutput_) Default() OrphanedResourceOperationOutput { - return Companion_OrphanedResourceOperationOutput_.Create_OrphanedResourceOperationOutput_(m_Wrappers.Companion_Option_.Default()) -} - -func (_this OrphanedResourceOperationOutput) Dtor_someString() m_Wrappers.Option { - return _this.Get_().(OrphanedResourceOperationOutput_OrphanedResourceOperationOutput).SomeString -} - -func (_this OrphanedResourceOperationOutput) String() string { - switch data := _this.Get_().(type) { - case nil: - return "null" - case OrphanedResourceOperationOutput_OrphanedResourceOperationOutput: - { - return "SimpleOrphanedTypes.OrphanedResourceOperationOutput.OrphanedResourceOperationOutput" + "(" + _dafny.String(data.SomeString) + ")" - } - default: - { - return "" - } - } -} - -func (_this OrphanedResourceOperationOutput) Equals(other OrphanedResourceOperationOutput) bool { - switch data1 := _this.Get_().(type) { - case OrphanedResourceOperationOutput_OrphanedResourceOperationOutput: - { - data2, ok := other.Get_().(OrphanedResourceOperationOutput_OrphanedResourceOperationOutput) - return ok && data1.SomeString.Equals(data2.SomeString) - } - default: - { - return false // unexpected - } - } -} - -func (_this OrphanedResourceOperationOutput) EqualsGeneric(other interface{}) bool { - typed, ok := other.(OrphanedResourceOperationOutput) - return ok && _this.Equals(typed) -} - -func Type_OrphanedResourceOperationOutput_() _dafny.TypeDescriptor { - return type_OrphanedResourceOperationOutput_{} -} - -type type_OrphanedResourceOperationOutput_ struct { -} - -func (_this type_OrphanedResourceOperationOutput_) Default() interface{} { - return Companion_OrphanedResourceOperationOutput_.Default() -} - -func (_this type_OrphanedResourceOperationOutput_) String() string { - return "SimpleOrphanedTypes.OrphanedResourceOperationOutput" -} -func (_this OrphanedResourceOperationOutput) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = OrphanedResourceOperationOutput{} - -// End of datatype OrphanedResourceOperationOutput - -// Definition of class IOrphanedResourceCallHistory -type IOrphanedResourceCallHistory struct { - dummy byte -} - -func New_IOrphanedResourceCallHistory_() *IOrphanedResourceCallHistory { - _this := IOrphanedResourceCallHistory{} - - return &_this -} - -type CompanionStruct_IOrphanedResourceCallHistory_ struct { -} - -var Companion_IOrphanedResourceCallHistory_ = CompanionStruct_IOrphanedResourceCallHistory_{} - -func (_this *IOrphanedResourceCallHistory) Equals(other *IOrphanedResourceCallHistory) bool { - return _this == other -} - -func (_this *IOrphanedResourceCallHistory) EqualsGeneric(x interface{}) bool { - other, ok := x.(*IOrphanedResourceCallHistory) - return ok && _this.Equals(other) -} - -func (*IOrphanedResourceCallHistory) String() string { - return "SimpleOrphanedTypes.IOrphanedResourceCallHistory" -} - -func Type_IOrphanedResourceCallHistory_() _dafny.TypeDescriptor { - return type_IOrphanedResourceCallHistory_{} -} - -type type_IOrphanedResourceCallHistory_ struct { -} - -func (_this type_IOrphanedResourceCallHistory_) Default() interface{} { - return (*IOrphanedResourceCallHistory)(nil) -} - -func (_this type_IOrphanedResourceCallHistory_) String() string { - return "SimpleOrphanedTypes.IOrphanedResourceCallHistory" -} -func (_this *IOrphanedResourceCallHistory) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = &IOrphanedResourceCallHistory{} - -// End of class IOrphanedResourceCallHistory - -// Definition of trait IOrphanedResource -type IOrphanedResource interface { - String() string - OrphanedResourceOperation(input OrphanedResourceOperationInput) m_Wrappers.Result - OrphanedResourceOperation_k(input OrphanedResourceOperationInput) m_Wrappers.Result -} - -func (_static *CompanionStruct_IOrphanedResource_) OrphanedResourceOperation(_this IOrphanedResource, input OrphanedResourceOperationInput) m_Wrappers.Result { - { - var output m_Wrappers.Result = m_Wrappers.Companion_Result_.Default(Companion_OrphanedResourceOperationOutput_.Default()) - _ = output - var _out0 m_Wrappers.Result - _ = _out0 - _out0 = (_this).OrphanedResourceOperation_k(input) - output = _out0 - return output - } -} - -type CompanionStruct_IOrphanedResource_ struct { - TraitID_ *_dafny.TraitID -} - -var Companion_IOrphanedResource_ = CompanionStruct_IOrphanedResource_{ - TraitID_: &_dafny.TraitID{}, -} - -func (CompanionStruct_IOrphanedResource_) CastTo_(x interface{}) IOrphanedResource { - var t IOrphanedResource - t, _ = x.(IOrphanedResource) - return t -} - -// End of trait IOrphanedResource - -// Definition of datatype OrphanedStructure -type OrphanedStructure struct { - Data_OrphanedStructure_ -} - -func (_this OrphanedStructure) Get_() Data_OrphanedStructure_ { - return _this.Data_OrphanedStructure_ -} - -type Data_OrphanedStructure_ interface { - isOrphanedStructure() -} - -type CompanionStruct_OrphanedStructure_ struct { -} - -var Companion_OrphanedStructure_ = CompanionStruct_OrphanedStructure_{} - -type OrphanedStructure_OrphanedStructure struct { - BlobValue m_Wrappers.Option - BooleanValue m_Wrappers.Option - StringValue m_Wrappers.Option - IntegerValue m_Wrappers.Option - LongValue m_Wrappers.Option - UnionValue m_Wrappers.Option - EnumValue m_Wrappers.Option - MapValue m_Wrappers.Option - ListValue m_Wrappers.Option -} - -func (OrphanedStructure_OrphanedStructure) isOrphanedStructure() {} - -func (CompanionStruct_OrphanedStructure_) Create_OrphanedStructure_(BlobValue m_Wrappers.Option, BooleanValue m_Wrappers.Option, StringValue m_Wrappers.Option, IntegerValue m_Wrappers.Option, LongValue m_Wrappers.Option, UnionValue m_Wrappers.Option, EnumValue m_Wrappers.Option, MapValue m_Wrappers.Option, ListValue m_Wrappers.Option) OrphanedStructure { - return OrphanedStructure{OrphanedStructure_OrphanedStructure{BlobValue, BooleanValue, StringValue, IntegerValue, LongValue, UnionValue, EnumValue, MapValue, ListValue}} -} - -func (_this OrphanedStructure) Is_OrphanedStructure() bool { - _, ok := _this.Get_().(OrphanedStructure_OrphanedStructure) - return ok -} - -func (CompanionStruct_OrphanedStructure_) Default() OrphanedStructure { - return Companion_OrphanedStructure_.Create_OrphanedStructure_(m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default(), m_Wrappers.Companion_Option_.Default()) -} - -func (_this OrphanedStructure) Dtor_blobValue() m_Wrappers.Option { - return _this.Get_().(OrphanedStructure_OrphanedStructure).BlobValue -} - -func (_this OrphanedStructure) Dtor_booleanValue() m_Wrappers.Option { - return _this.Get_().(OrphanedStructure_OrphanedStructure).BooleanValue -} - -func (_this OrphanedStructure) Dtor_stringValue() m_Wrappers.Option { - return _this.Get_().(OrphanedStructure_OrphanedStructure).StringValue -} - -func (_this OrphanedStructure) Dtor_integerValue() m_Wrappers.Option { - return _this.Get_().(OrphanedStructure_OrphanedStructure).IntegerValue -} - -func (_this OrphanedStructure) Dtor_longValue() m_Wrappers.Option { - return _this.Get_().(OrphanedStructure_OrphanedStructure).LongValue -} - -func (_this OrphanedStructure) Dtor_unionValue() m_Wrappers.Option { - return _this.Get_().(OrphanedStructure_OrphanedStructure).UnionValue -} - -func (_this OrphanedStructure) Dtor_enumValue() m_Wrappers.Option { - return _this.Get_().(OrphanedStructure_OrphanedStructure).EnumValue -} - -func (_this OrphanedStructure) Dtor_mapValue() m_Wrappers.Option { - return _this.Get_().(OrphanedStructure_OrphanedStructure).MapValue -} - -func (_this OrphanedStructure) Dtor_listValue() m_Wrappers.Option { - return _this.Get_().(OrphanedStructure_OrphanedStructure).ListValue -} - -func (_this OrphanedStructure) String() string { - switch data := _this.Get_().(type) { - case nil: - return "null" - case OrphanedStructure_OrphanedStructure: - { - return "SimpleOrphanedTypes.OrphanedStructure.OrphanedStructure" + "(" + _dafny.String(data.BlobValue) + ", " + _dafny.String(data.BooleanValue) + ", " + _dafny.String(data.StringValue) + ", " + _dafny.String(data.IntegerValue) + ", " + _dafny.String(data.LongValue) + ", " + _dafny.String(data.UnionValue) + ", " + _dafny.String(data.EnumValue) + ", " + _dafny.String(data.MapValue) + ", " + _dafny.String(data.ListValue) + ")" - } - default: - { - return "" - } - } -} - -func (_this OrphanedStructure) Equals(other OrphanedStructure) bool { - switch data1 := _this.Get_().(type) { - case OrphanedStructure_OrphanedStructure: - { - data2, ok := other.Get_().(OrphanedStructure_OrphanedStructure) - return ok && data1.BlobValue.Equals(data2.BlobValue) && data1.BooleanValue.Equals(data2.BooleanValue) && data1.StringValue.Equals(data2.StringValue) && data1.IntegerValue.Equals(data2.IntegerValue) && data1.LongValue.Equals(data2.LongValue) && data1.UnionValue.Equals(data2.UnionValue) && data1.EnumValue.Equals(data2.EnumValue) && data1.MapValue.Equals(data2.MapValue) && data1.ListValue.Equals(data2.ListValue) - } - default: - { - return false // unexpected - } - } -} - -func (_this OrphanedStructure) EqualsGeneric(other interface{}) bool { - typed, ok := other.(OrphanedStructure) - return ok && _this.Equals(typed) -} - -func Type_OrphanedStructure_() _dafny.TypeDescriptor { - return type_OrphanedStructure_{} -} - -type type_OrphanedStructure_ struct { -} - -func (_this type_OrphanedStructure_) Default() interface{} { - return Companion_OrphanedStructure_.Default() -} - -func (_this type_OrphanedStructure_) String() string { - return "SimpleOrphanedTypes.OrphanedStructure" -} -func (_this OrphanedStructure) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = OrphanedStructure{} - -// End of datatype OrphanedStructure - -// Definition of datatype OrphanedUnion -type OrphanedUnion struct { - Data_OrphanedUnion_ -} - -func (_this OrphanedUnion) Get_() Data_OrphanedUnion_ { - return _this.Data_OrphanedUnion_ -} - -type Data_OrphanedUnion_ interface { - isOrphanedUnion() -} - -type CompanionStruct_OrphanedUnion_ struct { -} - -var Companion_OrphanedUnion_ = CompanionStruct_OrphanedUnion_{} - -type OrphanedUnion_integerValue struct { - IntegerValue int32 -} - -func (OrphanedUnion_integerValue) isOrphanedUnion() {} - -func (CompanionStruct_OrphanedUnion_) Create_integerValue_(IntegerValue int32) OrphanedUnion { - return OrphanedUnion{OrphanedUnion_integerValue{IntegerValue}} -} - -func (_this OrphanedUnion) Is_integerValue() bool { - _, ok := _this.Get_().(OrphanedUnion_integerValue) - return ok -} - -type OrphanedUnion_stringValue struct { - StringValue _dafny.Sequence -} - -func (OrphanedUnion_stringValue) isOrphanedUnion() {} - -func (CompanionStruct_OrphanedUnion_) Create_stringValue_(StringValue _dafny.Sequence) OrphanedUnion { - return OrphanedUnion{OrphanedUnion_stringValue{StringValue}} -} - -func (_this OrphanedUnion) Is_stringValue() bool { - _, ok := _this.Get_().(OrphanedUnion_stringValue) - return ok -} - -func (CompanionStruct_OrphanedUnion_) Default() OrphanedUnion { - return Companion_OrphanedUnion_.Create_integerValue_(int32(0)) -} - -func (_this OrphanedUnion) Dtor_integerValue() int32 { - return _this.Get_().(OrphanedUnion_integerValue).IntegerValue -} - -func (_this OrphanedUnion) Dtor_stringValue() _dafny.Sequence { - return _this.Get_().(OrphanedUnion_stringValue).StringValue -} - -func (_this OrphanedUnion) String() string { - switch data := _this.Get_().(type) { - case nil: - return "null" - case OrphanedUnion_integerValue: - { - return "SimpleOrphanedTypes.OrphanedUnion.integerValue" + "(" + _dafny.String(data.IntegerValue) + ")" - } - case OrphanedUnion_stringValue: - { - return "SimpleOrphanedTypes.OrphanedUnion.stringValue" + "(" + _dafny.String(data.StringValue) + ")" - } - default: - { - return "" - } - } -} - -func (_this OrphanedUnion) Equals(other OrphanedUnion) bool { - switch data1 := _this.Get_().(type) { - case OrphanedUnion_integerValue: - { - data2, ok := other.Get_().(OrphanedUnion_integerValue) - return ok && data1.IntegerValue == data2.IntegerValue - } - case OrphanedUnion_stringValue: - { - data2, ok := other.Get_().(OrphanedUnion_stringValue) - return ok && data1.StringValue.Equals(data2.StringValue) - } - default: - { - return false // unexpected - } - } -} - -func (_this OrphanedUnion) EqualsGeneric(other interface{}) bool { - typed, ok := other.(OrphanedUnion) - return ok && _this.Equals(typed) -} - -func Type_OrphanedUnion_() _dafny.TypeDescriptor { - return type_OrphanedUnion_{} -} - -type type_OrphanedUnion_ struct { -} - -func (_this type_OrphanedUnion_) Default() interface{} { - return Companion_OrphanedUnion_.Default() -} - -func (_this type_OrphanedUnion_) String() string { - return "SimpleOrphanedTypes.OrphanedUnion" -} -func (_this OrphanedUnion) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = OrphanedUnion{} - -// End of datatype OrphanedUnion - -// Definition of datatype OrphanedV1Enum -type OrphanedV1Enum struct { - Data_OrphanedV1Enum_ -} - -func (_this OrphanedV1Enum) Get_() Data_OrphanedV1Enum_ { - return _this.Data_OrphanedV1Enum_ -} - -type Data_OrphanedV1Enum_ interface { - isOrphanedV1Enum() -} - -type CompanionStruct_OrphanedV1Enum_ struct { -} - -var Companion_OrphanedV1Enum_ = CompanionStruct_OrphanedV1Enum_{} - -type OrphanedV1Enum_FIRST struct { -} - -func (OrphanedV1Enum_FIRST) isOrphanedV1Enum() {} - -func (CompanionStruct_OrphanedV1Enum_) Create_FIRST_() OrphanedV1Enum { - return OrphanedV1Enum{OrphanedV1Enum_FIRST{}} -} - -func (_this OrphanedV1Enum) Is_FIRST() bool { - _, ok := _this.Get_().(OrphanedV1Enum_FIRST) - return ok -} - -type OrphanedV1Enum_SECOND struct { -} - -func (OrphanedV1Enum_SECOND) isOrphanedV1Enum() {} - -func (CompanionStruct_OrphanedV1Enum_) Create_SECOND_() OrphanedV1Enum { - return OrphanedV1Enum{OrphanedV1Enum_SECOND{}} -} - -func (_this OrphanedV1Enum) Is_SECOND() bool { - _, ok := _this.Get_().(OrphanedV1Enum_SECOND) - return ok -} - -type OrphanedV1Enum_THIRD struct { -} - -func (OrphanedV1Enum_THIRD) isOrphanedV1Enum() {} - -func (CompanionStruct_OrphanedV1Enum_) Create_THIRD_() OrphanedV1Enum { - return OrphanedV1Enum{OrphanedV1Enum_THIRD{}} -} - -func (_this OrphanedV1Enum) Is_THIRD() bool { - _, ok := _this.Get_().(OrphanedV1Enum_THIRD) - return ok -} - -func (CompanionStruct_OrphanedV1Enum_) Default() OrphanedV1Enum { - return Companion_OrphanedV1Enum_.Create_FIRST_() -} - -func (_ CompanionStruct_OrphanedV1Enum_) AllSingletonConstructors() _dafny.Iterator { - i := -1 - return func() (interface{}, bool) { - i++ - switch i { - case 0: - return Companion_OrphanedV1Enum_.Create_FIRST_(), true - case 1: - return Companion_OrphanedV1Enum_.Create_SECOND_(), true - case 2: - return Companion_OrphanedV1Enum_.Create_THIRD_(), true - default: - return OrphanedV1Enum{}, false - } - } -} - -func (_this OrphanedV1Enum) String() string { - switch _this.Get_().(type) { - case nil: - return "null" - case OrphanedV1Enum_FIRST: - { - return "SimpleOrphanedTypes.OrphanedV1Enum.FIRST" - } - case OrphanedV1Enum_SECOND: - { - return "SimpleOrphanedTypes.OrphanedV1Enum.SECOND" - } - case OrphanedV1Enum_THIRD: - { - return "SimpleOrphanedTypes.OrphanedV1Enum.THIRD" - } - default: - { - return "" - } - } -} - -func (_this OrphanedV1Enum) Equals(other OrphanedV1Enum) bool { - switch _this.Get_().(type) { - case OrphanedV1Enum_FIRST: - { - _, ok := other.Get_().(OrphanedV1Enum_FIRST) - return ok - } - case OrphanedV1Enum_SECOND: - { - _, ok := other.Get_().(OrphanedV1Enum_SECOND) - return ok - } - case OrphanedV1Enum_THIRD: - { - _, ok := other.Get_().(OrphanedV1Enum_THIRD) - return ok - } - default: - { - return false // unexpected - } - } -} - -func (_this OrphanedV1Enum) EqualsGeneric(other interface{}) bool { - typed, ok := other.(OrphanedV1Enum) - return ok && _this.Equals(typed) -} - -func Type_OrphanedV1Enum_() _dafny.TypeDescriptor { - return type_OrphanedV1Enum_{} -} - -type type_OrphanedV1Enum_ struct { -} - -func (_this type_OrphanedV1Enum_) Default() interface{} { - return Companion_OrphanedV1Enum_.Default() -} - -func (_this type_OrphanedV1Enum_) String() string { - return "SimpleOrphanedTypes.OrphanedV1Enum" -} -func (_this OrphanedV1Enum) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = OrphanedV1Enum{} - -// End of datatype OrphanedV1Enum - -// Definition of class ISimpleOrphanedClientCallHistory -type ISimpleOrphanedClientCallHistory struct { - dummy byte -} - -func New_ISimpleOrphanedClientCallHistory_() *ISimpleOrphanedClientCallHistory { - _this := ISimpleOrphanedClientCallHistory{} - - return &_this -} - -type CompanionStruct_ISimpleOrphanedClientCallHistory_ struct { -} - -var Companion_ISimpleOrphanedClientCallHistory_ = CompanionStruct_ISimpleOrphanedClientCallHistory_{} - -func (_this *ISimpleOrphanedClientCallHistory) Equals(other *ISimpleOrphanedClientCallHistory) bool { - return _this == other -} - -func (_this *ISimpleOrphanedClientCallHistory) EqualsGeneric(x interface{}) bool { - other, ok := x.(*ISimpleOrphanedClientCallHistory) - return ok && _this.Equals(other) -} - -func (*ISimpleOrphanedClientCallHistory) String() string { - return "SimpleOrphanedTypes.ISimpleOrphanedClientCallHistory" -} - -func Type_ISimpleOrphanedClientCallHistory_() _dafny.TypeDescriptor { - return type_ISimpleOrphanedClientCallHistory_{} -} - -type type_ISimpleOrphanedClientCallHistory_ struct { -} - -func (_this type_ISimpleOrphanedClientCallHistory_) Default() interface{} { - return (*ISimpleOrphanedClientCallHistory)(nil) -} - -func (_this type_ISimpleOrphanedClientCallHistory_) String() string { - return "SimpleOrphanedTypes.ISimpleOrphanedClientCallHistory" -} -func (_this *ISimpleOrphanedClientCallHistory) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = &ISimpleOrphanedClientCallHistory{} - -// End of class ISimpleOrphanedClientCallHistory - -// Definition of trait ISimpleOrphanedClient -type ISimpleOrphanedClient interface { - String() string -} -type CompanionStruct_ISimpleOrphanedClient_ struct { - TraitID_ *_dafny.TraitID -} - -var Companion_ISimpleOrphanedClient_ = CompanionStruct_ISimpleOrphanedClient_{ - TraitID_: &_dafny.TraitID{}, -} - -func (CompanionStruct_ISimpleOrphanedClient_) CastTo_(x interface{}) ISimpleOrphanedClient { - var t ISimpleOrphanedClient - t, _ = x.(ISimpleOrphanedClient) - return t -} - -// End of trait ISimpleOrphanedClient - -// Definition of datatype SimpleOrphanedConfig -type SimpleOrphanedConfig struct { - Data_SimpleOrphanedConfig_ -} - -func (_this SimpleOrphanedConfig) Get_() Data_SimpleOrphanedConfig_ { - return _this.Data_SimpleOrphanedConfig_ -} - -type Data_SimpleOrphanedConfig_ interface { - isSimpleOrphanedConfig() -} - -type CompanionStruct_SimpleOrphanedConfig_ struct { -} - -var Companion_SimpleOrphanedConfig_ = CompanionStruct_SimpleOrphanedConfig_{} - -type SimpleOrphanedConfig_SimpleOrphanedConfig struct { - StructureMember m_Wrappers.Option -} - -func (SimpleOrphanedConfig_SimpleOrphanedConfig) isSimpleOrphanedConfig() {} - -func (CompanionStruct_SimpleOrphanedConfig_) Create_SimpleOrphanedConfig_(StructureMember m_Wrappers.Option) SimpleOrphanedConfig { - return SimpleOrphanedConfig{SimpleOrphanedConfig_SimpleOrphanedConfig{StructureMember}} -} - -func (_this SimpleOrphanedConfig) Is_SimpleOrphanedConfig() bool { - _, ok := _this.Get_().(SimpleOrphanedConfig_SimpleOrphanedConfig) - return ok -} - -func (CompanionStruct_SimpleOrphanedConfig_) Default() SimpleOrphanedConfig { - return Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(m_Wrappers.Companion_Option_.Default()) -} - -func (_this SimpleOrphanedConfig) Dtor_structureMember() m_Wrappers.Option { - return _this.Get_().(SimpleOrphanedConfig_SimpleOrphanedConfig).StructureMember -} - -func (_this SimpleOrphanedConfig) String() string { - switch data := _this.Get_().(type) { - case nil: - return "null" - case SimpleOrphanedConfig_SimpleOrphanedConfig: - { - return "SimpleOrphanedTypes.SimpleOrphanedConfig.SimpleOrphanedConfig" + "(" + _dafny.String(data.StructureMember) + ")" - } - default: - { - return "" - } - } -} - -func (_this SimpleOrphanedConfig) Equals(other SimpleOrphanedConfig) bool { - switch data1 := _this.Get_().(type) { - case SimpleOrphanedConfig_SimpleOrphanedConfig: - { - data2, ok := other.Get_().(SimpleOrphanedConfig_SimpleOrphanedConfig) - return ok && data1.StructureMember.Equals(data2.StructureMember) - } - default: - { - return false // unexpected - } - } -} - -func (_this SimpleOrphanedConfig) EqualsGeneric(other interface{}) bool { - typed, ok := other.(SimpleOrphanedConfig) - return ok && _this.Equals(typed) -} - -func Type_SimpleOrphanedConfig_() _dafny.TypeDescriptor { - return type_SimpleOrphanedConfig_{} -} - -type type_SimpleOrphanedConfig_ struct { -} - -func (_this type_SimpleOrphanedConfig_) Default() interface{} { - return Companion_SimpleOrphanedConfig_.Default() -} - -func (_this type_SimpleOrphanedConfig_) String() string { - return "SimpleOrphanedTypes.SimpleOrphanedConfig" -} -func (_this SimpleOrphanedConfig) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = SimpleOrphanedConfig{} - -// End of datatype SimpleOrphanedConfig - -// Definition of datatype Error -type Error struct { - Data_Error_ -} - -func (_this Error) Get_() Data_Error_ { - return _this.Data_Error_ -} - -type Data_Error_ interface { - isError() -} - -type CompanionStruct_Error_ struct { -} - -var Companion_Error_ = CompanionStruct_Error_{} - -type Error_OrphanedError struct { - Message _dafny.Sequence -} - -func (Error_OrphanedError) isError() {} - -func (CompanionStruct_Error_) Create_OrphanedError_(Message _dafny.Sequence) Error { - return Error{Error_OrphanedError{Message}} -} - -func (_this Error) Is_OrphanedError() bool { - _, ok := _this.Get_().(Error_OrphanedError) - return ok -} - -type Error_CollectionOfErrors struct { - List _dafny.Sequence - Message _dafny.Sequence -} - -func (Error_CollectionOfErrors) isError() {} - -func (CompanionStruct_Error_) Create_CollectionOfErrors_(List _dafny.Sequence, Message _dafny.Sequence) Error { - return Error{Error_CollectionOfErrors{List, Message}} -} - -func (_this Error) Is_CollectionOfErrors() bool { - _, ok := _this.Get_().(Error_CollectionOfErrors) - return ok -} - -type Error_Opaque struct { - Obj interface{} -} - -func (Error_Opaque) isError() {} - -func (CompanionStruct_Error_) Create_Opaque_(Obj interface{}) Error { - return Error{Error_Opaque{Obj}} -} - -func (_this Error) Is_Opaque() bool { - _, ok := _this.Get_().(Error_Opaque) - return ok -} - -type Error_OpaqueWithText struct { - Obj interface{} - ObjMessage _dafny.Sequence -} - -func (Error_OpaqueWithText) isError() {} - -func (CompanionStruct_Error_) Create_OpaqueWithText_(Obj interface{}, ObjMessage _dafny.Sequence) Error { - return Error{Error_OpaqueWithText{Obj, ObjMessage}} -} - -func (_this Error) Is_OpaqueWithText() bool { - _, ok := _this.Get_().(Error_OpaqueWithText) - return ok -} - -func (CompanionStruct_Error_) Default() Error { - return Companion_Error_.Create_OrphanedError_(_dafny.EmptySeq.SetString()) -} - -func (_this Error) Dtor_message() _dafny.Sequence { - switch data := _this.Get_().(type) { - case Error_OrphanedError: - return data.Message - default: - return data.(Error_CollectionOfErrors).Message - } -} - -func (_this Error) Dtor_list() _dafny.Sequence { - return _this.Get_().(Error_CollectionOfErrors).List -} - -func (_this Error) Dtor_obj() interface{} { - switch data := _this.Get_().(type) { - case Error_Opaque: - return data.Obj - default: - return data.(Error_OpaqueWithText).Obj - } -} - -func (_this Error) Dtor_objMessage() _dafny.Sequence { - return _this.Get_().(Error_OpaqueWithText).ObjMessage -} - -func (_this Error) String() string { - switch data := _this.Get_().(type) { - case nil: - return "null" - case Error_OrphanedError: - { - return "SimpleOrphanedTypes.Error.OrphanedError" + "(" + _dafny.String(data.Message) + ")" - } - case Error_CollectionOfErrors: - { - return "SimpleOrphanedTypes.Error.CollectionOfErrors" + "(" + _dafny.String(data.List) + ", " + _dafny.String(data.Message) + ")" - } - case Error_Opaque: - { - return "SimpleOrphanedTypes.Error.Opaque" + "(" + _dafny.String(data.Obj) + ")" - } - case Error_OpaqueWithText: - { - return "SimpleOrphanedTypes.Error.OpaqueWithText" + "(" + _dafny.String(data.Obj) + ", " + _dafny.String(data.ObjMessage) + ")" - } - default: - { - return "" - } - } -} - -func (_this Error) Equals(other Error) bool { - switch data1 := _this.Get_().(type) { - case Error_OrphanedError: - { - data2, ok := other.Get_().(Error_OrphanedError) - return ok && data1.Message.Equals(data2.Message) - } - case Error_CollectionOfErrors: - { - data2, ok := other.Get_().(Error_CollectionOfErrors) - return ok && data1.List.Equals(data2.List) && data1.Message.Equals(data2.Message) - } - case Error_Opaque: - { - data2, ok := other.Get_().(Error_Opaque) - return ok && _dafny.AreEqual(data1.Obj, data2.Obj) - } - case Error_OpaqueWithText: - { - data2, ok := other.Get_().(Error_OpaqueWithText) - return ok && _dafny.AreEqual(data1.Obj, data2.Obj) && data1.ObjMessage.Equals(data2.ObjMessage) - } - default: - { - return false // unexpected - } - } -} - -func (_this Error) EqualsGeneric(other interface{}) bool { - typed, ok := other.(Error) - return ok && _this.Equals(typed) -} - -func Type_Error_() _dafny.TypeDescriptor { - return type_Error_{} -} - -type type_Error_ struct { -} - -func (_this type_Error_) Default() interface{} { - return Companion_Error_.Default() -} - -func (_this type_Error_) String() string { - return "SimpleOrphanedTypes.Error" -} -func (_this Error) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = Error{} - -// End of datatype Error - -// Definition of class OpaqueError -type OpaqueError struct { -} - -func New_OpaqueError_() *OpaqueError { - _this := OpaqueError{} - - return &_this -} - -type CompanionStruct_OpaqueError_ struct { -} - -var Companion_OpaqueError_ = CompanionStruct_OpaqueError_{} - -func (*OpaqueError) String() string { - return "SimpleOrphanedTypes.OpaqueError" -} - -// End of class OpaqueError - -func Type_OpaqueError_() _dafny.TypeDescriptor { - return type_OpaqueError_{} -} - -type type_OpaqueError_ struct { -} - -func (_this type_OpaqueError_) Default() interface{} { - return Companion_Error_.Default() -} - -func (_this type_OpaqueError_) String() string { - return "SimpleOrphanedTypes.OpaqueError" -} -func (_this *CompanionStruct_OpaqueError_) Is_(__source Error) bool { - var _0_e Error = (__source) - _ = _0_e - return ((_0_e).Is_Opaque()) || ((_0_e).Is_OpaqueWithText()) -} - -// Definition of class DummySubsetType -type DummySubsetType struct { -} - -func New_DummySubsetType_() *DummySubsetType { - _this := DummySubsetType{} - - return &_this -} - -type CompanionStruct_DummySubsetType_ struct { -} - -var Companion_DummySubsetType_ = CompanionStruct_DummySubsetType_{} - -func (*DummySubsetType) String() string { - return "SimpleOrphanedTypes.DummySubsetType" -} -func (_this *CompanionStruct_DummySubsetType_) Witness() _dafny.Int { - return _dafny.One -} - -// End of class DummySubsetType - -func Type_DummySubsetType_() _dafny.TypeDescriptor { - return type_DummySubsetType_{} -} - -type type_DummySubsetType_ struct { -} - -func (_this type_DummySubsetType_) Default() interface{} { - return Companion_DummySubsetType_.Witness() -} - -func (_this type_DummySubsetType_) String() string { - return "SimpleOrphanedTypes.DummySubsetType" -} -func (_this *CompanionStruct_DummySubsetType_) Is_(__source _dafny.Int) bool { - var _1_x _dafny.Int = (__source) - _ = _1_x - return Companion_Default___.IsDummySubsetType(_1_x) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/WrappedSimpleOrphanedService/shim.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/WrappedSimpleOrphanedService/shim.go deleted file mode 100644 index 3a19ee0ce1..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/WrappedSimpleOrphanedService/shim.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package WrappedSimpleOrphanedService - -import ( - "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygenerated" -) - -type Shim struct { - SimpleOrphanedTypes.ISimpleOrphanedClient - client *simpleorphanedsmithygenerated.Client -} - -func (_static *CompanionStruct_Default___) WrappedSimpleOrphaned(inputConfig SimpleOrphanedTypes.SimpleOrphanedConfig) Wrappers.Result { - var nativeConfig = simpleorphanedsmithygenerated.SimpleOrphanedConfig_FromDafny(inputConfig) - var nativeClient, nativeError = simpleorphanedsmithygenerated.NewClient(nativeConfig) - if nativeError != nil { - return Wrappers.Companion_Result_.Create_Failure_(SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeError)) - } - return Wrappers.Companion_Result_.Create_Success_(&Shim{client: nativeClient}) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/shim.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/shim.go deleted file mode 100644 index 782d87a636..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/shim.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package WrappedSimpleOrphanedService - -import ( - "context" - - "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygenerated" -) - -type Shim struct { - SimpleOrphanedTypes.ISimpleOrphanedClient - client *simpleorphanedsmithygenerated.Client -} - -func (_static *CompanionStruct_Default___) WrappedSimpleOrphaned(inputConfig SimpleOrphanedTypes.SimpleOrphanedConfig) Wrappers.Result { - var nativeConfig = simpleorphanedsmithygenerated.SimpleOrphanedConfig_FromDafny(inputConfig) - var nativeClient, nativeError = simpleorphanedsmithygenerated.NewClient(nativeConfig) - if nativeError != nil { - return Wrappers.Companion_Result_.Create_Failure_(SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeError)) - } - return Wrappers.Companion_Result_.Create_Success_(&Shim{client: nativeClient}) -} - -func (shim *Shim) CreateOrphanedStructure(input SimpleOrphanedTypes.CreateOrphanedStructureInput) Wrappers.Result { - var native_request = simpleorphanedsmithygenerated.CreateOrphanedStructureInput_FromDafny(input) - var native_response, native_error = shim.client.CreateOrphanedStructure(context.Background(), native_request) - if native_error != nil { - return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) - } - return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedStructureOutput_ToDafny(*native_response)) -} - -func (shim *Shim) CreateOrphanedResource(input SimpleOrphanedTypes.CreateOrphanedResourceInput) Wrappers.Result { - var native_request = simpleorphanedsmithygenerated.CreateOrphanedResourceInput_FromDafny(input) - var native_response, native_error = shim.client.CreateOrphanedResource(context.Background(), native_request) - if native_error != nil { - return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) - } - return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedResourceOutput_ToDafny(*native_response)) -} - -func (shim *Shim) CreateOrphanedError(input SimpleOrphanedTypes.CreateOrphanedErrorInput) Wrappers.Result { - var native_request = simpleorphanedsmithygenerated.CreateOrphanedErrorInput_FromDafny(input) - var native_response, native_error = shim.client.CreateOrphanedError(context.Background(), native_request) - if native_error != nil { - return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) - } - return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedErrorOutput_ToDafny(*native_response)) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go deleted file mode 100644 index 9418326060..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -type OrphanedResource struct { - Impl SimpleOrphanedTypes.IOrphanedResource -} - -func (this *OrphanedResource) OrphanedResourceOperation(params simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput) (*simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput, error) { - var dafny_request SimpleOrphanedTypes.OrphanedResourceOperationInput = OrphanedResourceOperationInput_ToDafny(params) - var dafny_response = this.Impl.OrphanedResourceOperation(dafny_request) - - if dafny_response.Is_Failure() { - err := dafny_response.Dtor_error().(SimpleOrphanedTypes.Error) - return nil, Error_FromDafny(err) - } - var native_response = OrphanedResourceOperationOutput_FromDafny(dafny_response.Dtor_value().(SimpleOrphanedTypes.OrphanedResourceOperationOutput)) - return &native_response, nil - -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go deleted file mode 100644 index 98fdb52ec9..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -type OrphanedResourceNativeWrapper struct { - SimpleOrphanedTypes.IOrphanedResource - Impl simpleorphanedsmithygeneratedtypes.IOrphanedResource -} - -func (this *OrphanedResourceNativeWrapper) OrphanedResourceOperation(input SimpleOrphanedTypes.OrphanedResourceOperationInput) Wrappers.Result { - var native_request = OrphanedResourceOperationInput_FromDafny(input) - var native_response, native_error = this.Impl.OrphanedResourceOperation(native_request) - if native_error != nil { - return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) - } - return Wrappers.Companion_Result_.Create_Success_(OrphanedResourceOperationOutput_ToDafny(*native_response)) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/api_client.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/api_client.go deleted file mode 100644 index f40b82ca89..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/api_client.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -type Client struct { - DafnyClient SimpleOrphanedTypes.ISimpleOrphanedClient -} - -func NewClient(clientConfig simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig) (*Client, error) { - var dafnyConfig = SimpleOrphanedConfig_ToDafny(clientConfig) - var dafny_response = SimpleOrphaned.Companion_Default___.SimpleOrphaned(dafnyConfig) - if dafny_response.Is_Failure() { - panic("Client construction failed. This should never happen") - } - var dafnyClient = dafny_response.Extract().(SimpleOrphanedTypes.ISimpleOrphanedClient) - client := &Client{dafnyClient} - return client, nil -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go deleted file mode 100644 index 52358df9e6..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -func OrphanedResourceOperationInput_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput) SimpleOrphanedTypes.OrphanedResourceOperationInput { - - return func() SimpleOrphanedTypes.OrphanedResourceOperationInput { - - return SimpleOrphanedTypes.Companion_OrphanedResourceOperationInput_.Create_OrphanedResourceOperationInput_(simple_orphaned_OrphanedResourceOperationInput_someString_ToDafny(nativeInput.SomeString)) - }() - -} - -func OrphanedResourceOperationOutput_ToDafny(nativeOutput simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput) SimpleOrphanedTypes.OrphanedResourceOperationOutput { - - return func() SimpleOrphanedTypes.OrphanedResourceOperationOutput { - - return SimpleOrphanedTypes.Companion_OrphanedResourceOperationOutput_.Create_OrphanedResourceOperationOutput_(simple_orphaned_OrphanedResourceOperationOutput_someString_ToDafny(nativeOutput.SomeString)) - }() - -} - -func OrphanedResource_ToDafny(nativeResource simpleorphanedsmithygeneratedtypes.IOrphanedResource) SimpleOrphanedTypes.IOrphanedResource { - val, ok := nativeResource.(*OrphanedResource) - if ok { - return val.Impl - } - return OrphanedResource{&OrphanedResourceNativeWrapper{Impl: nativeResource}}.Impl - -} - -func OrphanedError_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OrphanedError) SimpleOrphanedTypes.Error { - return func() SimpleOrphanedTypes.Error { - - return SimpleOrphanedTypes.Companion_Error_.Create_OrphanedError_(simple_orphaned_OrphanedError_message_ToDafny(nativeInput.Message)) - }() - -} - -func CollectionOfErrors_Input_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.CollectionOfErrors) SimpleOrphanedTypes.Error { - var e []interface{} - for _, i2 := range nativeInput.ListOfErrors { - e = append(e, Error_ToDafny(i2)) - } - return SimpleOrphanedTypes.Companion_Error_.Create_CollectionOfErrors_(dafny.SeqOf(e...), dafny.SeqOfChars([]dafny.Char(nativeInput.Message)...)) -} -func OpaqueError_Input_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OpaqueError) SimpleOrphanedTypes.Error { - return SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeInput.ErrObject) -} - -func Error_ToDafny(err error) SimpleOrphanedTypes.Error { - switch err.(type) { - // Service Errors - case simpleorphanedsmithygeneratedtypes.OrphanedError: - return OrphanedError_ToDafny(err.(simpleorphanedsmithygeneratedtypes.OrphanedError)) - - //DependentErrors - - //Unmodelled Errors - case simpleorphanedsmithygeneratedtypes.CollectionOfErrors: - return CollectionOfErrors_Input_ToDafny(err.(simpleorphanedsmithygeneratedtypes.CollectionOfErrors)) - - default: - error, ok := err.(simpleorphanedsmithygeneratedtypes.OpaqueError) - if !ok { - panic("Error is not an OpaqueError") - } - return OpaqueError_Input_ToDafny(error) - } -} - -func SimpleOrphanedConfig_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig) SimpleOrphanedTypes.SimpleOrphanedConfig { - return func() SimpleOrphanedTypes.SimpleOrphanedConfig { - - return SimpleOrphanedTypes.Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(simple_orphaned_SimpleOrphanedConfig_structureMember_ToDafny(nativeInput.StructureMember)) - }() - -} - -func simple_orphaned_SimpleOrphanedConfig_structureMember_ToDafny(input *simpleorphanedsmithygeneratedtypes.OrphanedConfigShape) Wrappers.Option { - return func() Wrappers.Option { - if input == nil { - return Wrappers.Companion_Option_.Create_None_() - } - return Wrappers.Companion_Option_.Create_Some_(SimpleOrphanedTypes.Companion_OrphanedConfigShape_.Create_OrphanedConfigShape_(simple_orphaned_OrphanedConfigShape_stringMember_ToDafny(input.StringMember))) - }() -} - -func simple_orphaned_OrphanedError_message_ToDafny(input string) dafny.Sequence { - return func() dafny.Sequence { - - return dafny.SeqOfChars([]dafny.Char(input)...) - }() -} - -func simple_orphaned_OrphanedConfigShape_stringMember_ToDafny(input *string) Wrappers.Option { - return func() Wrappers.Option { - if input == nil { - return Wrappers.Companion_Option_.Create_None_() - } - return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) - }() -} - -func simple_orphaned_OrphanedResourceOperationInput_someString_ToDafny(input *string) Wrappers.Option { - return func() Wrappers.Option { - if input == nil { - return Wrappers.Companion_Option_.Create_None_() - } - return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) - }() -} - -func simple_orphaned_OrphanedResourceOperationOutput_someString_ToDafny(input *string) Wrappers.Option { - return func() Wrappers.Option { - if input == nil { - return Wrappers.Companion_Option_.Create_None_() - } - return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) - }() -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_native.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_native.go deleted file mode 100644 index 2a951e89ca..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygenerated/to_native.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -func OrphanedResourceOperationInput_FromDafny(dafnyInput SimpleOrphanedTypes.OrphanedResourceOperationInput) simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput { - - return simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput{SomeString: simple_orphaned_OrphanedResourceOperationInput_someString_FromDafny(dafnyInput.Dtor_someString().UnwrapOr(nil))} - -} - -func OrphanedResourceOperationOutput_FromDafny(dafnyOutput SimpleOrphanedTypes.OrphanedResourceOperationOutput) simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput { - - return simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput{SomeString: simple_orphaned_OrphanedResourceOperationOutput_someString_FromDafny(dafnyOutput.Dtor_someString().UnwrapOr(nil))} - -} - -func OrphanedResource_FromDafny(dafnyResource SimpleOrphanedTypes.IOrphanedResource) simpleorphanedsmithygeneratedtypes.IOrphanedResource { - val, ok := dafnyResource.(*OrphanedResourceNativeWrapper) - if ok { - return val.Impl - } - - return &OrphanedResource{dafnyResource} -} - -func OrphanedError_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.OrphanedError { - return simpleorphanedsmithygeneratedtypes.OrphanedError{Message: simple_orphaned_OrphanedError_message_FromDafny(dafnyOutput.Dtor_message())} - -} - -func CollectionOfErrors_Output_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.CollectionOfErrors { - listOfErrors := dafnyOutput.Dtor_list() - message := dafnyOutput.Dtor_message() - t := simpleorphanedsmithygeneratedtypes.CollectionOfErrors{} - for i := dafny.Iterate(listOfErrors); ; { - val, ok := i() - if !ok { - break - } - err := val.(SimpleOrphanedTypes.Error) - t.ListOfErrors = append(t.ListOfErrors, Error_FromDafny(err)) - - } - t.Message = func() string { - var s string - for i := dafny.Iterate(message); ; { - val, ok := i() - if !ok { - return s - } else { - s = s + string(val.(dafny.Char)) - } - } - }() - return t -} -func OpaqueError_Output_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.OpaqueError { - return simpleorphanedsmithygeneratedtypes.OpaqueError{ - ErrObject: dafnyOutput.Dtor_obj(), - } -} - -func Error_FromDafny(err SimpleOrphanedTypes.Error) error { - // Service Errors - if err.Is_OrphanedError() { - return OrphanedError_FromDafny(err) - } - - //DependentErrors - - //Unmodelled Errors - if err.Is_CollectionOfErrors() { - return CollectionOfErrors_Output_FromDafny(err) - } - - return OpaqueError_Output_FromDafny(err) -} - -func SimpleOrphanedConfig_FromDafny(dafnyOutput SimpleOrphanedTypes.SimpleOrphanedConfig) simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig { - return simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig{StructureMember: simple_orphaned_SimpleOrphanedConfig_structureMember_FromDafny(dafnyOutput.Dtor_structureMember().UnwrapOr(nil))} - -} - -func simple_orphaned_SimpleOrphanedConfig_structureMember_FromDafny(input interface{}) *simpleorphanedsmithygeneratedtypes.OrphanedConfigShape { - if input == nil { - return nil - } - return &simpleorphanedsmithygeneratedtypes.OrphanedConfigShape{StringMember: simple_orphaned_OrphanedConfigShape_stringMember_FromDafny(input.(SimpleOrphanedTypes.OrphanedConfigShape).Dtor_stringMember().UnwrapOr(nil))} -} -func simple_orphaned_OrphanedError_message_FromDafny(input interface{}) string { - return func() string { - var s string - for i := dafny.Iterate(input); ; { - val, ok := i() - if !ok { - return s - } else { - s = s + string(val.(dafny.Char)) - } - } - }() -} -func simple_orphaned_OrphanedConfigShape_stringMember_FromDafny(input interface{}) *string { - return func() *string { - var s string - if input == nil { - return nil - } - for i := dafny.Iterate(input); ; { - val, ok := i() - if !ok { - return &[]string{s}[0] - } else { - s = s + string(val.(dafny.Char)) - } - } - }() -} -func simple_orphaned_OrphanedResourceOperationInput_someString_FromDafny(input interface{}) *string { - return func() *string { - var s string - if input == nil { - return nil - } - for i := dafny.Iterate(input); ; { - val, ok := i() - if !ok { - return &[]string{s}[0] - } else { - s = s + string(val.(dafny.Char)) - } - } - }() -} -func simple_orphaned_OrphanedResourceOperationOutput_someString_FromDafny(input interface{}) *string { - return func() *string { - var s string - if input == nil { - return nil - } - for i := dafny.Iterate(input); ; { - val, ok := i() - if !ok { - return &[]string{s}[0] - } else { - s = s + string(val.(dafny.Char)) - } - } - }() -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go deleted file mode 100644 index b2f3fea8f5..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygeneratedtypes - -type OrphanedV1Enum string - -const ( - OrphanedV1EnumFirst OrphanedV1Enum = "0x0014" - OrphanedV1EnumSecond OrphanedV1Enum = "0x0046" - OrphanedV1EnumThird OrphanedV1Enum = "0x0078" -) - -func (OrphanedV1Enum) Values() []OrphanedV1Enum { - return []OrphanedV1Enum{ - "0x0014", - "0x0046", - "0x0078", - } -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go deleted file mode 100644 index 7db66d4f95..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygeneratedtypes - -import ( - "fmt" -) - -type OrphanedError struct { - SimpleOrphanedBaseException - Message string - ErrorCodeOverride *string -} - -func (e OrphanedError) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go deleted file mode 100644 index 5fb450e2aa..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go +++ /dev/null @@ -1,177 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygeneratedtypes - -import ( - "fmt" -) - -type CreateOrphanedErrorInput struct { -} - -func (input CreateOrphanedErrorInput) Validate() error { - - return nil -} - -type CreateOrphanedErrorOutput struct { -} - -func (input CreateOrphanedErrorOutput) Validate() error { - - return nil -} - -type CreateOrphanedResourceInput struct { -} - -func (input CreateOrphanedResourceInput) Validate() error { - - return nil -} - -type CreateOrphanedResourceOutput struct { -} - -func (input CreateOrphanedResourceOutput) Validate() error { - - return nil -} - -type CreateOrphanedStructureInput struct { -} - -func (input CreateOrphanedStructureInput) Validate() error { - - return nil -} - -type CreateOrphanedStructureOutput struct { -} - -func (input CreateOrphanedStructureOutput) Validate() error { - - return nil -} - -type OrphanedConfigShape struct { - StringMember *string -} - -func (input OrphanedConfigShape) Validate() error { - - return nil -} - -type OrphanedResourceOperationInput struct { - SomeString *string -} - -func (input OrphanedResourceOperationInput) Validate() error { - - return nil -} - -type OrphanedResourceOperationOutput struct { - SomeString *string -} - -func (input OrphanedResourceOperationOutput) Validate() error { - - return nil -} - -type OrphanedResourceReference struct { -} - -func (input OrphanedResourceReference) Validate() error { - - return nil -} - -type OrphanedStructure struct { - BlobValue []byte - - BooleanValue *bool - - EnumValue *OrphanedV1Enum - - IntegerValue *int32 - - ListValue []string - - LongValue *int64 - - MapValue map[string]string - - StringValue *string - - UnionValue OrphanedUnion -} - -func (input OrphanedStructure) Validate() error { - if input.simple_orphaned_OrphanedStructure_unionValue_Validate() != nil { - return input.simple_orphaned_OrphanedStructure_unionValue_Validate() - } - - return nil -} - -func (input OrphanedStructure) simple_orphaned_OrphanedStructure_unionValue_Validate() error { - if input.UnionValue == nil { - return nil - } - switch unionType := input.UnionValue.(type) { - case *OrphanedUnionMemberintegerValue: - case *OrphanedUnionMemberstringValue: - // Default case should not be reached. - default: - panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) - } - - return nil -} - -type SimpleOrphanedConfig struct { - StructureMember *OrphanedConfigShape -} - -func (input SimpleOrphanedConfig) Validate() error { - if input.StructureMember != nil { - if input.StructureMember.Validate() != nil { - return input.StructureMember.Validate() - } - - } - - return nil -} - -// OrphanedUnionMemberintegerValue -// OrphanedUnionMemberstringValue -type OrphanedUnion interface { - isOrphanedUnion() -} - -type OrphanedUnionMemberintegerValue struct { - Value int32 -} - -func (*OrphanedUnionMemberintegerValue) isOrphanedUnion() {} - -type OrphanedUnionMemberstringValue struct { - Value string -} - -func (*OrphanedUnionMemberstringValue) isOrphanedUnion() {} - -type SimpleOrphanedBaseException interface { - // This is a dummy method to allow type assertion since Go empty interfaces - // aren't useful for type assertion checks. No concrete class is expected to implement - // this method. This is also not exported. - interfaceBindingMethod() -} - -type IOrphanedResource interface { - OrphanedResourceOperation(OrphanedResourceOperationInput) (*OrphanedResourceOperationOutput, error) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go b/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go deleted file mode 100644 index 982a370aff..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/ImplementationFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygeneratedtypes - -import ( - "fmt" -) - -type CollectionOfErrors struct { - SimpleOrphanedBaseException - ListOfErrors []error - Message string -} - -func (e CollectionOfErrors) Error() string { - return fmt.Sprintf("message: %s\n err %v", e.Message, e.ListOfErrors) -} - -type OpaqueError struct { - SimpleOrphanedBaseException - ErrObject interface{} -} - -func (e OpaqueError) Error() string { - return fmt.Sprintf("message: %v", e.ErrObject) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/ExternDefinitions.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/ExternDefinitions.go deleted file mode 100644 index 1b272edc9d..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/ExternDefinitions.go +++ /dev/null @@ -1,129 +0,0 @@ -// Package ExternDefinitions -// Dafny module ExternDefinitions compiled into Go - -package ExternDefinitions - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" - m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" - m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" - m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - m_WrappedSimpleOrphanedService "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/WrappedSimpleOrphanedService" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_SimpleOrphanedTypes.Dummy__ -var _ m_SimpleOrphanedImpl.Dummy__ -var _ m_SimpleOrphaned.Dummy__ -var _ m_OrphanedResource.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ -var _ m_WrappedSimpleOrphanedService.Dummy__ - -type Dummy__ struct{} - -// Definition of class Default__ -type Default__ struct { - dummy byte -} - -func New_Default___() *Default__ { - _this := Default__{} - - return &_this -} - -type CompanionStruct_Default___ struct { -} - -var Companion_Default___ = CompanionStruct_Default___{} - -func (_this *Default__) Equals(other *Default__) bool { - return _this == other -} - -func (_this *Default__) EqualsGeneric(x interface{}) bool { - other, ok := x.(*Default__) - return ok && _this.Equals(other) -} - -func (*Default__) String() string { - return "ExternDefinitions.Default__" -} -func (_this *Default__) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = &Default__{} - -func (_static *CompanionStruct_Default___) TestOrphanedStructure() { - var _0_uninitializedStructure m_SimpleOrphanedTypes.OrphanedStructure - _ = _0_uninitializedStructure - _0_uninitializedStructure = m_SimpleOrphanedTypes.Companion_OrphanedStructure_.Create_OrphanedStructure_(m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_(), m_Wrappers.Companion_Option_.Create_None_()) - var _1_initializedStructure m_SimpleOrphanedTypes.OrphanedStructure - _ = _1_initializedStructure - var _out0 m_SimpleOrphanedTypes.OrphanedStructure - _ = _out0 - _out0 = Companion_Default___.InitializeOrphanedStructure(_0_uninitializedStructure) - _1_initializedStructure = _out0 - if !(((_1_initializedStructure).Dtor_stringValue()).Is_Some()) { - panic("test/ExternDefinitions.dfy(16,4): " + (_dafny.SeqOfString("expectation violation")).String()) - } - if !(_dafny.Companion_Sequence_.Equal(((_1_initializedStructure).Dtor_stringValue()).Dtor_value().(_dafny.Sequence), _dafny.SeqOfString("the extern MUST use Smithy-generated conversions to set this value in the native structure"))) { - panic("test/ExternDefinitions.dfy(17,4): " + (_dafny.SeqOfString("expectation violation")).String()) - } -} -func (_static *CompanionStruct_Default___) TestOrphanedResource() { - var _0_resource *m_OrphanedResource.OrphanedResource - _ = _0_resource - var _nw0 *m_OrphanedResource.OrphanedResource = m_OrphanedResource.New_OrphanedResource_() - _ = _nw0 - _nw0.Ctor__() - _0_resource = _nw0 - var _1_ret m_Wrappers.Result - _ = _1_ret - var _out0 m_Wrappers.Result - _ = _out0 - _out0 = Companion_Default___.CallNativeOrphanedResource(_0_resource) - _1_ret = _out0 - if !((_1_ret).Is_Success()) { - panic("test/ExternDefinitions.dfy(25,4): " + (_dafny.SeqOfString("expectation violation")).String()) - } - if !((((_1_ret).Dtor_value().(m_SimpleOrphanedTypes.OrphanedResourceOperationOutput)).Dtor_someString()).Is_Some()) { - panic("test/ExternDefinitions.dfy(26,4): " + (_dafny.SeqOfString("expectation violation")).String()) - } - if !(_dafny.Companion_Sequence_.Equal((((_1_ret).Dtor_value().(m_SimpleOrphanedTypes.OrphanedResourceOperationOutput)).Dtor_someString()).Dtor_value().(_dafny.Sequence), _dafny.SeqOfString("correct string"))) { - panic("test/ExternDefinitions.dfy(27,4): " + (_dafny.SeqOfString("expectation violation")).String()) - } -} -func (_static *CompanionStruct_Default___) TestOrphanedError() { - var _0_error m_SimpleOrphanedTypes.Error - _ = _0_error - _0_error = m_SimpleOrphanedTypes.Companion_Error_.Create_OrphanedError_(_dafny.SeqOfString("TBD")) - var _1_out__error m_SimpleOrphanedTypes.Error - _ = _1_out__error - var _out0 m_SimpleOrphanedTypes.Error - _ = _out0 - _out0 = Companion_Default___.CallNativeOrphanedError(_0_error) - _1_out__error = _out0 - if !((_1_out__error).Is_OrphanedError()) { - panic("test/ExternDefinitions.dfy(35,4): " + (_dafny.SeqOfString("expectation violation")).String()) - } - if !(_dafny.Companion_Sequence_.Equal((_1_out__error).Dtor_message(), _dafny.SeqOfString("the extern MUST use Smithy-generated conversions to set this value in the native error"))) { - panic("test/ExternDefinitions.dfy(36,4): " + (_dafny.SeqOfString("expectation violation")).String()) - } -} - -// End of class Default__ diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go index af3ffcf4d2..6b1a3bbda4 100644 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go +++ b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/ExternDefinitions/extern.go @@ -12,6 +12,9 @@ import ( var _ Wrappers.Dummy__ +// TODO: Finish implementation. +// This is missing structure converter. + func (CompanionStruct_Default___) InitializeOrphanedStructure(input SimpleOrphanedTypes.OrphanedStructure) SimpleOrphanedTypes.OrphanedStructure { // Missing Structure converter return input @@ -19,12 +22,8 @@ func (CompanionStruct_Default___) InitializeOrphanedStructure(input SimpleOrphan func (CompanionStruct_Default___) CallNativeOrphanedResource(input *OrphanedResource.OrphanedResource) Wrappers.Result { native_resource := simpleorphanedsmithygenerated.OrphanedResource_FromDafny(input) - fmt.Printf("Type of native_resource: %T\n", native_resource) someString := "the extern MUST provide this string to the native resource's operation" - fmt.Printf("Type of someString: %T\n", someString) - fmt.Printf("Type of &someString: %T\n", &someString) native_output, err := native_resource.OrphanedResourceOperation(simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput{SomeString: &someString}) - fmt.Printf("Type of native_output: %T\n", native_output) if err != nil { return Wrappers.Companion_Result_.Create_Failure_(err) } diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny-go.dtr b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny-go.dtr deleted file mode 100644 index 2091a168d9..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny-go.dtr +++ /dev/null @@ -1,14 +0,0 @@ -file_format_version = "1.0" -dafny_version = "4.9.0.0" -[options_by_module.WrappedAbstractSimpleOrphanedService] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test" -legacy-module-names = false -[options_by_module.WrappedSimpleOrphanedService] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test" -legacy-module-names = false -[options_by_module.ExternDefinitions] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test" -legacy-module-names = false -[options_by_module.WrappedTest] -go-module-name = "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test" -legacy-module-names = false diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny.go deleted file mode 100644 index 60b91afb37..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/TestsFromDafny.go +++ /dev/null @@ -1,144 +0,0 @@ -// Dafny program the_program compiled into Go -package main - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" - m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" - m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" - m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - m_ExternDefinitions "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/ExternDefinitions" - m_WrappedSimpleOrphanedService "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/WrappedSimpleOrphanedService" - m_WrappedTest "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/WrappedTest" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_SimpleOrphanedTypes.Dummy__ -var _ m_SimpleOrphanedImpl.Dummy__ -var _ m_SimpleOrphaned.Dummy__ -var _ m_OrphanedResource.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ -var _ m_WrappedSimpleOrphanedService.Dummy__ -var _ m_ExternDefinitions.Dummy__ -var _ m_WrappedTest.Dummy__ - -// Definition of class Default__ -type Default__ struct { - dummy byte -} - -func New_Default___() *Default__ { - _this := Default__{} - - return &_this -} - -type CompanionStruct_Default___ struct { -} - -var Companion_Default___ = CompanionStruct_Default___{} - -func (_this *Default__) Equals(other *Default__) bool { - return _this == other -} - -func (_this *Default__) EqualsGeneric(x interface{}) bool { - other, ok := x.(*Default__) - return ok && _this.Equals(other) -} - -func (*Default__) String() string { - return "_module.Default__" -} -func (_this *Default__) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = &Default__{} - -func (_static *CompanionStruct_Default___) Test____Main____(__noArgsParameter _dafny.Sequence) { - var _0_success bool - _ = _0_success - _0_success = true - _dafny.Print((_dafny.SeqOfString("WrappedTest.TestOrphanedStructure: ")).SetString()) - func() { - defer func() { - if r := recover(); r != nil { - var _1_haltMessage = _dafny.SeqOfString(r.(string)) - { - _dafny.Print((_dafny.SeqOfString("FAILED\n ")).SetString()) - _dafny.Print((_1_haltMessage).SetString()) - _dafny.Print((_dafny.SeqOfString("\n")).SetString()) - _0_success = false - } - } - }() - { - m_WrappedTest.Companion_Default___.TestOrphanedStructure() - { - _dafny.Print((_dafny.SeqOfString("PASSED\n")).SetString()) - } - } - }() - _dafny.Print((_dafny.SeqOfString("WrappedTest.TestOrphanedResource: ")).SetString()) - func() { - defer func() { - if r := recover(); r != nil { - var _2_haltMessage = _dafny.SeqOfString(r.(string)) - { - _dafny.Print((_dafny.SeqOfString("FAILED\n ")).SetString()) - _dafny.Print((_2_haltMessage).SetString()) - _dafny.Print((_dafny.SeqOfString("\n")).SetString()) - _0_success = false - } - } - }() - { - m_WrappedTest.Companion_Default___.TestOrphanedResource() - { - _dafny.Print((_dafny.SeqOfString("PASSED\n")).SetString()) - } - } - }() - _dafny.Print((_dafny.SeqOfString("WrappedTest.TestOrphanedError: ")).SetString()) - func() { - defer func() { - if r := recover(); r != nil { - var _3_haltMessage = _dafny.SeqOfString(r.(string)) - { - _dafny.Print((_dafny.SeqOfString("FAILED\n ")).SetString()) - _dafny.Print((_3_haltMessage).SetString()) - _dafny.Print((_dafny.SeqOfString("\n")).SetString()) - _0_success = false - } - } - }() - { - m_WrappedTest.Companion_Default___.TestOrphanedError() - { - _dafny.Print((_dafny.SeqOfString("PASSED\n")).SetString()) - } - } - }() - if !(_0_success) { - panic("(1,0): " + (_dafny.SeqOfString("Test failures occurred: see above.\n")).String()) - } -} - -// End of class Default__ -func main() { - defer _dafny.CatchHalt() - Companion_Default___.Test____Main____(_dafny.FromMainArguments(os.Args)) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/WrappedSimpleOrphanedService.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/WrappedSimpleOrphanedService.go deleted file mode 100644 index 44835ff2f8..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/WrappedSimpleOrphanedService.go +++ /dev/null @@ -1,73 +0,0 @@ -// Package WrappedSimpleOrphanedService -// Dafny module WrappedSimpleOrphanedService compiled into Go - -package WrappedSimpleOrphanedService - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" - m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" - m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" - m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_SimpleOrphanedTypes.Dummy__ -var _ m_SimpleOrphanedImpl.Dummy__ -var _ m_SimpleOrphaned.Dummy__ -var _ m_OrphanedResource.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ - -type Dummy__ struct{} - -// Definition of class Default__ -type Default__ struct { - dummy byte -} - -func New_Default___() *Default__ { - _this := Default__{} - - return &_this -} - -type CompanionStruct_Default___ struct { -} - -var Companion_Default___ = CompanionStruct_Default___{} - -func (_this *Default__) Equals(other *Default__) bool { - return _this == other -} - -func (_this *Default__) EqualsGeneric(x interface{}) bool { - other, ok := x.(*Default__) - return ok && _this.Equals(other) -} - -func (*Default__) String() string { - return "WrappedSimpleOrphanedService.Default__" -} -func (_this *Default__) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = &Default__{} - -func (_static *CompanionStruct_Default___) WrappedDefaultSimpleOrphanedConfig() m_SimpleOrphanedTypes.SimpleOrphanedConfig { - return m_SimpleOrphanedTypes.Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(m_Wrappers.Companion_Option_.Create_None_()) -} - -// End of class Default__ diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/shim.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/shim.go deleted file mode 100644 index 3a19ee0ce1..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedSimpleOrphanedService/shim.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package WrappedSimpleOrphanedService - -import ( - "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygenerated" -) - -type Shim struct { - SimpleOrphanedTypes.ISimpleOrphanedClient - client *simpleorphanedsmithygenerated.Client -} - -func (_static *CompanionStruct_Default___) WrappedSimpleOrphaned(inputConfig SimpleOrphanedTypes.SimpleOrphanedConfig) Wrappers.Result { - var nativeConfig = simpleorphanedsmithygenerated.SimpleOrphanedConfig_FromDafny(inputConfig) - var nativeClient, nativeError = simpleorphanedsmithygenerated.NewClient(nativeConfig) - if nativeError != nil { - return Wrappers.Companion_Result_.Create_Failure_(SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeError)) - } - return Wrappers.Companion_Result_.Create_Success_(&Shim{client: nativeClient}) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedTest/WrappedTest.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedTest/WrappedTest.go deleted file mode 100644 index e0c2fa2e38..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/WrappedTest/WrappedTest.go +++ /dev/null @@ -1,83 +0,0 @@ -// Package WrappedTest -// Dafny module WrappedTest compiled into Go - -package WrappedTest - -import ( - os "os" - - m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" - _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - m_StandardLibrary "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary" - m_StandardLibraryInterop "github.com/dafny-lang/DafnyStandardLibGo/StandardLibraryInterop" - m_StandardLibrary_UInt "github.com/dafny-lang/DafnyStandardLibGo/StandardLibrary_UInt" - m_Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - m_OrphanedResource "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/OrphanedResource" - m_SimpleOrphaned "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" - m_SimpleOrphanedImpl "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedImpl" - m_SimpleOrphanedTypes "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - m_ExternDefinitions "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/ExternDefinitions" - m_WrappedSimpleOrphanedService "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/test/WrappedSimpleOrphanedService" -) - -var _ = os.Args -var _ _dafny.Dummy__ -var _ m__System.Dummy__ -var _ m_Wrappers.Dummy__ -var _ m_StandardLibrary_UInt.Dummy__ -var _ m_StandardLibrary.Dummy__ -var _ m_SimpleOrphanedTypes.Dummy__ -var _ m_SimpleOrphanedImpl.Dummy__ -var _ m_SimpleOrphaned.Dummy__ -var _ m_OrphanedResource.Dummy__ -var _ m_StandardLibraryInterop.Dummy__ -var _ m_WrappedSimpleOrphanedService.Dummy__ -var _ m_ExternDefinitions.Dummy__ - -type Dummy__ struct{} - -// Definition of class Default__ -type Default__ struct { - dummy byte -} - -func New_Default___() *Default__ { - _this := Default__{} - - return &_this -} - -type CompanionStruct_Default___ struct { -} - -var Companion_Default___ = CompanionStruct_Default___{} - -func (_this *Default__) Equals(other *Default__) bool { - return _this == other -} - -func (_this *Default__) EqualsGeneric(x interface{}) bool { - other, ok := x.(*Default__) - return ok && _this.Equals(other) -} - -func (*Default__) String() string { - return "WrappedTest.Default__" -} -func (_this *Default__) ParentTraits_() []*_dafny.TraitID { - return [](*_dafny.TraitID){} -} - -var _ _dafny.TraitOffspring = &Default__{} - -func (_static *CompanionStruct_Default___) TestOrphanedStructure() { - m_ExternDefinitions.Companion_Default___.TestOrphanedStructure() -} -func (_static *CompanionStruct_Default___) TestOrphanedResource() { - m_ExternDefinitions.Companion_Default___.TestOrphanedResource() -} -func (_static *CompanionStruct_Default___) TestOrphanedError() { - m_ExternDefinitions.Companion_Default___.TestOrphanedError() -} - -// End of class Default__ diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.sum b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.sum deleted file mode 100644 index 229929b8c5..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1 h1:dOgaw3i0I9nWKPjfXYzEfgWsVRJykL6FA18DErvQiJQ= -github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.1/go.mod h1:l2Tm4N2DKuq3ljONC2vOATeM9PUpXbIc8SgXdwwqEto= diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/shim.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/shim.go deleted file mode 100644 index 782d87a636..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/shim.go +++ /dev/null @@ -1,52 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package WrappedSimpleOrphanedService - -import ( - "context" - - "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygenerated" -) - -type Shim struct { - SimpleOrphanedTypes.ISimpleOrphanedClient - client *simpleorphanedsmithygenerated.Client -} - -func (_static *CompanionStruct_Default___) WrappedSimpleOrphaned(inputConfig SimpleOrphanedTypes.SimpleOrphanedConfig) Wrappers.Result { - var nativeConfig = simpleorphanedsmithygenerated.SimpleOrphanedConfig_FromDafny(inputConfig) - var nativeClient, nativeError = simpleorphanedsmithygenerated.NewClient(nativeConfig) - if nativeError != nil { - return Wrappers.Companion_Result_.Create_Failure_(SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeError)) - } - return Wrappers.Companion_Result_.Create_Success_(&Shim{client: nativeClient}) -} - -func (shim *Shim) CreateOrphanedStructure(input SimpleOrphanedTypes.CreateOrphanedStructureInput) Wrappers.Result { - var native_request = simpleorphanedsmithygenerated.CreateOrphanedStructureInput_FromDafny(input) - var native_response, native_error = shim.client.CreateOrphanedStructure(context.Background(), native_request) - if native_error != nil { - return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) - } - return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedStructureOutput_ToDafny(*native_response)) -} - -func (shim *Shim) CreateOrphanedResource(input SimpleOrphanedTypes.CreateOrphanedResourceInput) Wrappers.Result { - var native_request = simpleorphanedsmithygenerated.CreateOrphanedResourceInput_FromDafny(input) - var native_response, native_error = shim.client.CreateOrphanedResource(context.Background(), native_request) - if native_error != nil { - return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) - } - return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedResourceOutput_ToDafny(*native_response)) -} - -func (shim *Shim) CreateOrphanedError(input SimpleOrphanedTypes.CreateOrphanedErrorInput) Wrappers.Result { - var native_request = simpleorphanedsmithygenerated.CreateOrphanedErrorInput_FromDafny(input) - var native_response, native_error = shim.client.CreateOrphanedError(context.Background(), native_request) - if native_error != nil { - return Wrappers.Companion_Result_.Create_Failure_(simpleorphanedsmithygenerated.Error_ToDafny(native_error)) - } - return Wrappers.Companion_Result_.Create_Success_(simpleorphanedsmithygenerated.CreateOrphanedErrorOutput_ToDafny(*native_response)) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go deleted file mode 100644 index 9418326060..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResource.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -type OrphanedResource struct { - Impl SimpleOrphanedTypes.IOrphanedResource -} - -func (this *OrphanedResource) OrphanedResourceOperation(params simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput) (*simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput, error) { - var dafny_request SimpleOrphanedTypes.OrphanedResourceOperationInput = OrphanedResourceOperationInput_ToDafny(params) - var dafny_response = this.Impl.OrphanedResourceOperation(dafny_request) - - if dafny_response.Is_Failure() { - err := dafny_response.Dtor_error().(SimpleOrphanedTypes.Error) - return nil, Error_FromDafny(err) - } - var native_response = OrphanedResourceOperationOutput_FromDafny(dafny_response.Dtor_value().(SimpleOrphanedTypes.OrphanedResourceOperationOutput)) - return &native_response, nil - -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go deleted file mode 100644 index 98fdb52ec9..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/OrphanedResourceNativeWrapper.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -type OrphanedResourceNativeWrapper struct { - SimpleOrphanedTypes.IOrphanedResource - Impl simpleorphanedsmithygeneratedtypes.IOrphanedResource -} - -func (this *OrphanedResourceNativeWrapper) OrphanedResourceOperation(input SimpleOrphanedTypes.OrphanedResourceOperationInput) Wrappers.Result { - var native_request = OrphanedResourceOperationInput_FromDafny(input) - var native_response, native_error = this.Impl.OrphanedResourceOperation(native_request) - if native_error != nil { - return Wrappers.Companion_Result_.Create_Failure_(Error_ToDafny(native_error)) - } - return Wrappers.Companion_Result_.Create_Success_(OrphanedResourceOperationOutput_ToDafny(*native_response)) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/api_client.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/api_client.go deleted file mode 100644 index f40b82ca89..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/api_client.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphaned" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -type Client struct { - DafnyClient SimpleOrphanedTypes.ISimpleOrphanedClient -} - -func NewClient(clientConfig simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig) (*Client, error) { - var dafnyConfig = SimpleOrphanedConfig_ToDafny(clientConfig) - var dafny_response = SimpleOrphaned.Companion_Default___.SimpleOrphaned(dafnyConfig) - if dafny_response.Is_Failure() { - panic("Client construction failed. This should never happen") - } - var dafnyClient = dafny_response.Extract().(SimpleOrphanedTypes.ISimpleOrphanedClient) - client := &Client{dafnyClient} - return client, nil -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go deleted file mode 100644 index 52358df9e6..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_dafny.go +++ /dev/null @@ -1,128 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - "github.com/dafny-lang/DafnyStandardLibGo/Wrappers" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -func OrphanedResourceOperationInput_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput) SimpleOrphanedTypes.OrphanedResourceOperationInput { - - return func() SimpleOrphanedTypes.OrphanedResourceOperationInput { - - return SimpleOrphanedTypes.Companion_OrphanedResourceOperationInput_.Create_OrphanedResourceOperationInput_(simple_orphaned_OrphanedResourceOperationInput_someString_ToDafny(nativeInput.SomeString)) - }() - -} - -func OrphanedResourceOperationOutput_ToDafny(nativeOutput simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput) SimpleOrphanedTypes.OrphanedResourceOperationOutput { - - return func() SimpleOrphanedTypes.OrphanedResourceOperationOutput { - - return SimpleOrphanedTypes.Companion_OrphanedResourceOperationOutput_.Create_OrphanedResourceOperationOutput_(simple_orphaned_OrphanedResourceOperationOutput_someString_ToDafny(nativeOutput.SomeString)) - }() - -} - -func OrphanedResource_ToDafny(nativeResource simpleorphanedsmithygeneratedtypes.IOrphanedResource) SimpleOrphanedTypes.IOrphanedResource { - val, ok := nativeResource.(*OrphanedResource) - if ok { - return val.Impl - } - return OrphanedResource{&OrphanedResourceNativeWrapper{Impl: nativeResource}}.Impl - -} - -func OrphanedError_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OrphanedError) SimpleOrphanedTypes.Error { - return func() SimpleOrphanedTypes.Error { - - return SimpleOrphanedTypes.Companion_Error_.Create_OrphanedError_(simple_orphaned_OrphanedError_message_ToDafny(nativeInput.Message)) - }() - -} - -func CollectionOfErrors_Input_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.CollectionOfErrors) SimpleOrphanedTypes.Error { - var e []interface{} - for _, i2 := range nativeInput.ListOfErrors { - e = append(e, Error_ToDafny(i2)) - } - return SimpleOrphanedTypes.Companion_Error_.Create_CollectionOfErrors_(dafny.SeqOf(e...), dafny.SeqOfChars([]dafny.Char(nativeInput.Message)...)) -} -func OpaqueError_Input_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.OpaqueError) SimpleOrphanedTypes.Error { - return SimpleOrphanedTypes.Companion_Error_.Create_Opaque_(nativeInput.ErrObject) -} - -func Error_ToDafny(err error) SimpleOrphanedTypes.Error { - switch err.(type) { - // Service Errors - case simpleorphanedsmithygeneratedtypes.OrphanedError: - return OrphanedError_ToDafny(err.(simpleorphanedsmithygeneratedtypes.OrphanedError)) - - //DependentErrors - - //Unmodelled Errors - case simpleorphanedsmithygeneratedtypes.CollectionOfErrors: - return CollectionOfErrors_Input_ToDafny(err.(simpleorphanedsmithygeneratedtypes.CollectionOfErrors)) - - default: - error, ok := err.(simpleorphanedsmithygeneratedtypes.OpaqueError) - if !ok { - panic("Error is not an OpaqueError") - } - return OpaqueError_Input_ToDafny(error) - } -} - -func SimpleOrphanedConfig_ToDafny(nativeInput simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig) SimpleOrphanedTypes.SimpleOrphanedConfig { - return func() SimpleOrphanedTypes.SimpleOrphanedConfig { - - return SimpleOrphanedTypes.Companion_SimpleOrphanedConfig_.Create_SimpleOrphanedConfig_(simple_orphaned_SimpleOrphanedConfig_structureMember_ToDafny(nativeInput.StructureMember)) - }() - -} - -func simple_orphaned_SimpleOrphanedConfig_structureMember_ToDafny(input *simpleorphanedsmithygeneratedtypes.OrphanedConfigShape) Wrappers.Option { - return func() Wrappers.Option { - if input == nil { - return Wrappers.Companion_Option_.Create_None_() - } - return Wrappers.Companion_Option_.Create_Some_(SimpleOrphanedTypes.Companion_OrphanedConfigShape_.Create_OrphanedConfigShape_(simple_orphaned_OrphanedConfigShape_stringMember_ToDafny(input.StringMember))) - }() -} - -func simple_orphaned_OrphanedError_message_ToDafny(input string) dafny.Sequence { - return func() dafny.Sequence { - - return dafny.SeqOfChars([]dafny.Char(input)...) - }() -} - -func simple_orphaned_OrphanedConfigShape_stringMember_ToDafny(input *string) Wrappers.Option { - return func() Wrappers.Option { - if input == nil { - return Wrappers.Companion_Option_.Create_None_() - } - return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) - }() -} - -func simple_orphaned_OrphanedResourceOperationInput_someString_ToDafny(input *string) Wrappers.Option { - return func() Wrappers.Option { - if input == nil { - return Wrappers.Companion_Option_.Create_None_() - } - return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) - }() -} - -func simple_orphaned_OrphanedResourceOperationOutput_someString_ToDafny(input *string) Wrappers.Option { - return func() Wrappers.Option { - if input == nil { - return Wrappers.Companion_Option_.Create_None_() - } - return Wrappers.Companion_Option_.Create_Some_(dafny.SeqOfChars([]dafny.Char(*input)...)) - }() -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_native.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_native.go deleted file mode 100644 index 2a951e89ca..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygenerated/to_native.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygenerated - -import ( - "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/SimpleOrphanedTypes" - "github.com/smithy-lang/smithy-dafny/TestModels/OrphanedShapes/simpleorphanedsmithygeneratedtypes" -) - -func OrphanedResourceOperationInput_FromDafny(dafnyInput SimpleOrphanedTypes.OrphanedResourceOperationInput) simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput { - - return simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationInput{SomeString: simple_orphaned_OrphanedResourceOperationInput_someString_FromDafny(dafnyInput.Dtor_someString().UnwrapOr(nil))} - -} - -func OrphanedResourceOperationOutput_FromDafny(dafnyOutput SimpleOrphanedTypes.OrphanedResourceOperationOutput) simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput { - - return simpleorphanedsmithygeneratedtypes.OrphanedResourceOperationOutput{SomeString: simple_orphaned_OrphanedResourceOperationOutput_someString_FromDafny(dafnyOutput.Dtor_someString().UnwrapOr(nil))} - -} - -func OrphanedResource_FromDafny(dafnyResource SimpleOrphanedTypes.IOrphanedResource) simpleorphanedsmithygeneratedtypes.IOrphanedResource { - val, ok := dafnyResource.(*OrphanedResourceNativeWrapper) - if ok { - return val.Impl - } - - return &OrphanedResource{dafnyResource} -} - -func OrphanedError_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.OrphanedError { - return simpleorphanedsmithygeneratedtypes.OrphanedError{Message: simple_orphaned_OrphanedError_message_FromDafny(dafnyOutput.Dtor_message())} - -} - -func CollectionOfErrors_Output_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.CollectionOfErrors { - listOfErrors := dafnyOutput.Dtor_list() - message := dafnyOutput.Dtor_message() - t := simpleorphanedsmithygeneratedtypes.CollectionOfErrors{} - for i := dafny.Iterate(listOfErrors); ; { - val, ok := i() - if !ok { - break - } - err := val.(SimpleOrphanedTypes.Error) - t.ListOfErrors = append(t.ListOfErrors, Error_FromDafny(err)) - - } - t.Message = func() string { - var s string - for i := dafny.Iterate(message); ; { - val, ok := i() - if !ok { - return s - } else { - s = s + string(val.(dafny.Char)) - } - } - }() - return t -} -func OpaqueError_Output_FromDafny(dafnyOutput SimpleOrphanedTypes.Error) simpleorphanedsmithygeneratedtypes.OpaqueError { - return simpleorphanedsmithygeneratedtypes.OpaqueError{ - ErrObject: dafnyOutput.Dtor_obj(), - } -} - -func Error_FromDafny(err SimpleOrphanedTypes.Error) error { - // Service Errors - if err.Is_OrphanedError() { - return OrphanedError_FromDafny(err) - } - - //DependentErrors - - //Unmodelled Errors - if err.Is_CollectionOfErrors() { - return CollectionOfErrors_Output_FromDafny(err) - } - - return OpaqueError_Output_FromDafny(err) -} - -func SimpleOrphanedConfig_FromDafny(dafnyOutput SimpleOrphanedTypes.SimpleOrphanedConfig) simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig { - return simpleorphanedsmithygeneratedtypes.SimpleOrphanedConfig{StructureMember: simple_orphaned_SimpleOrphanedConfig_structureMember_FromDafny(dafnyOutput.Dtor_structureMember().UnwrapOr(nil))} - -} - -func simple_orphaned_SimpleOrphanedConfig_structureMember_FromDafny(input interface{}) *simpleorphanedsmithygeneratedtypes.OrphanedConfigShape { - if input == nil { - return nil - } - return &simpleorphanedsmithygeneratedtypes.OrphanedConfigShape{StringMember: simple_orphaned_OrphanedConfigShape_stringMember_FromDafny(input.(SimpleOrphanedTypes.OrphanedConfigShape).Dtor_stringMember().UnwrapOr(nil))} -} -func simple_orphaned_OrphanedError_message_FromDafny(input interface{}) string { - return func() string { - var s string - for i := dafny.Iterate(input); ; { - val, ok := i() - if !ok { - return s - } else { - s = s + string(val.(dafny.Char)) - } - } - }() -} -func simple_orphaned_OrphanedConfigShape_stringMember_FromDafny(input interface{}) *string { - return func() *string { - var s string - if input == nil { - return nil - } - for i := dafny.Iterate(input); ; { - val, ok := i() - if !ok { - return &[]string{s}[0] - } else { - s = s + string(val.(dafny.Char)) - } - } - }() -} -func simple_orphaned_OrphanedResourceOperationInput_someString_FromDafny(input interface{}) *string { - return func() *string { - var s string - if input == nil { - return nil - } - for i := dafny.Iterate(input); ; { - val, ok := i() - if !ok { - return &[]string{s}[0] - } else { - s = s + string(val.(dafny.Char)) - } - } - }() -} -func simple_orphaned_OrphanedResourceOperationOutput_someString_FromDafny(input interface{}) *string { - return func() *string { - var s string - if input == nil { - return nil - } - for i := dafny.Iterate(input); ; { - val, ok := i() - if !ok { - return &[]string{s}[0] - } else { - s = s + string(val.(dafny.Char)) - } - } - }() -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go deleted file mode 100644 index b2f3fea8f5..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/enums.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygeneratedtypes - -type OrphanedV1Enum string - -const ( - OrphanedV1EnumFirst OrphanedV1Enum = "0x0014" - OrphanedV1EnumSecond OrphanedV1Enum = "0x0046" - OrphanedV1EnumThird OrphanedV1Enum = "0x0078" -) - -func (OrphanedV1Enum) Values() []OrphanedV1Enum { - return []OrphanedV1Enum{ - "0x0014", - "0x0046", - "0x0078", - } -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go deleted file mode 100644 index 7db66d4f95..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/errors.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygeneratedtypes - -import ( - "fmt" -) - -type OrphanedError struct { - SimpleOrphanedBaseException - Message string - ErrorCodeOverride *string -} - -func (e OrphanedError) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCodeOverride, e.Message) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go deleted file mode 100644 index 5fb450e2aa..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/types.go +++ /dev/null @@ -1,177 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygeneratedtypes - -import ( - "fmt" -) - -type CreateOrphanedErrorInput struct { -} - -func (input CreateOrphanedErrorInput) Validate() error { - - return nil -} - -type CreateOrphanedErrorOutput struct { -} - -func (input CreateOrphanedErrorOutput) Validate() error { - - return nil -} - -type CreateOrphanedResourceInput struct { -} - -func (input CreateOrphanedResourceInput) Validate() error { - - return nil -} - -type CreateOrphanedResourceOutput struct { -} - -func (input CreateOrphanedResourceOutput) Validate() error { - - return nil -} - -type CreateOrphanedStructureInput struct { -} - -func (input CreateOrphanedStructureInput) Validate() error { - - return nil -} - -type CreateOrphanedStructureOutput struct { -} - -func (input CreateOrphanedStructureOutput) Validate() error { - - return nil -} - -type OrphanedConfigShape struct { - StringMember *string -} - -func (input OrphanedConfigShape) Validate() error { - - return nil -} - -type OrphanedResourceOperationInput struct { - SomeString *string -} - -func (input OrphanedResourceOperationInput) Validate() error { - - return nil -} - -type OrphanedResourceOperationOutput struct { - SomeString *string -} - -func (input OrphanedResourceOperationOutput) Validate() error { - - return nil -} - -type OrphanedResourceReference struct { -} - -func (input OrphanedResourceReference) Validate() error { - - return nil -} - -type OrphanedStructure struct { - BlobValue []byte - - BooleanValue *bool - - EnumValue *OrphanedV1Enum - - IntegerValue *int32 - - ListValue []string - - LongValue *int64 - - MapValue map[string]string - - StringValue *string - - UnionValue OrphanedUnion -} - -func (input OrphanedStructure) Validate() error { - if input.simple_orphaned_OrphanedStructure_unionValue_Validate() != nil { - return input.simple_orphaned_OrphanedStructure_unionValue_Validate() - } - - return nil -} - -func (input OrphanedStructure) simple_orphaned_OrphanedStructure_unionValue_Validate() error { - if input.UnionValue == nil { - return nil - } - switch unionType := input.UnionValue.(type) { - case *OrphanedUnionMemberintegerValue: - case *OrphanedUnionMemberstringValue: - // Default case should not be reached. - default: - panic(fmt.Sprintf("Unhandled union type: %T ", unionType)) - } - - return nil -} - -type SimpleOrphanedConfig struct { - StructureMember *OrphanedConfigShape -} - -func (input SimpleOrphanedConfig) Validate() error { - if input.StructureMember != nil { - if input.StructureMember.Validate() != nil { - return input.StructureMember.Validate() - } - - } - - return nil -} - -// OrphanedUnionMemberintegerValue -// OrphanedUnionMemberstringValue -type OrphanedUnion interface { - isOrphanedUnion() -} - -type OrphanedUnionMemberintegerValue struct { - Value int32 -} - -func (*OrphanedUnionMemberintegerValue) isOrphanedUnion() {} - -type OrphanedUnionMemberstringValue struct { - Value string -} - -func (*OrphanedUnionMemberstringValue) isOrphanedUnion() {} - -type SimpleOrphanedBaseException interface { - // This is a dummy method to allow type assertion since Go empty interfaces - // aren't useful for type assertion checks. No concrete class is expected to implement - // this method. This is also not exported. - interfaceBindingMethod() -} - -type IOrphanedResource interface { - OrphanedResourceOperation(OrphanedResourceOperationInput) (*OrphanedResourceOperationOutput, error) -} diff --git a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go b/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go deleted file mode 100644 index 982a370aff..0000000000 --- a/TestModels/OrphanedShapes/runtimes/go/TestsFromDafny-go/simpleorphanedsmithygeneratedtypes/unmodelled_errors.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package simpleorphanedsmithygeneratedtypes - -import ( - "fmt" -) - -type CollectionOfErrors struct { - SimpleOrphanedBaseException - ListOfErrors []error - Message string -} - -func (e CollectionOfErrors) Error() string { - return fmt.Sprintf("message: %s\n err %v", e.Message, e.ListOfErrors) -} - -type OpaqueError struct { - SimpleOrphanedBaseException - ErrObject interface{} -} - -func (e OpaqueError) Error() string { - return fmt.Sprintf("message: %v", e.ErrObject) -} From daae9d938ec911bf5f8593c27748416f82a33038 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 14:51:17 -0800 Subject: [PATCH 21/32] m --- .../SimpleOrphanedShapesImpl_Compile.cs | 31 ---------- .../WrappedSimpleOrphanedShapesService.cs | 19 ------- .../net/ImplementationFromDafny-cs.dtr | 14 ----- .../runtimes/net/SimpleOrphanedShapes.csproj | 29 ---------- .../net/tests/SimpleOrphanedShapesTest.csproj | 26 --------- .../runtimes/net/tests/TestsFromDafny-cs.dtr | 8 --- .../test/internaldafny/extern/__init__.py | 2 + .../test/internaldafny/extern/test_externs.py | 5 +- .../runtimes/rust/src/extern_definitions.rs | 29 ++-------- .../OrphanedShapes/src/ExternDefinitions.dfy | 56 ------------------- .../OrphanedShapes/src/SimpleOrphanedImpl.dfy | 48 ---------------- .../OrphanedShapes/test/ExternDefinitions.dfy | 32 +++-------- .../OrphanedShapes/test/WrappedTest.dfy | 16 +----- .../Model/RecursiveShape.smithy | 2 +- 14 files changed, 20 insertions(+), 297 deletions(-) delete mode 100644 TestModels/OrphanedShapes/runtimes/net/Extern/SimpleOrphanedShapesImpl_Compile.cs delete mode 100644 TestModels/OrphanedShapes/runtimes/net/Extern/WrappedSimpleOrphanedShapesService.cs delete mode 100644 TestModels/OrphanedShapes/runtimes/net/ImplementationFromDafny-cs.dtr delete mode 100644 TestModels/OrphanedShapes/runtimes/net/SimpleOrphanedShapes.csproj delete mode 100644 TestModels/OrphanedShapes/runtimes/net/tests/SimpleOrphanedShapesTest.csproj delete mode 100644 TestModels/OrphanedShapes/runtimes/net/tests/TestsFromDafny-cs.dtr delete mode 100644 TestModels/OrphanedShapes/src/ExternDefinitions.dfy diff --git a/TestModels/OrphanedShapes/runtimes/net/Extern/SimpleOrphanedShapesImpl_Compile.cs b/TestModels/OrphanedShapes/runtimes/net/Extern/SimpleOrphanedShapesImpl_Compile.cs deleted file mode 100644 index 02fa0e407a..0000000000 --- a/TestModels/OrphanedShapes/runtimes/net/Extern/SimpleOrphanedShapesImpl_Compile.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -using System; -using Dafny; -using simple.orphanedshapes.internaldafny.types; -using Simple.OrphanedShapes; -using Wrappers_Compile; - -namespace SimpleOrphanedShapesImpl_Compile -{ - public partial class __default - { - public static simple.orphanedshapes.internaldafny.types._IOrphanedStructure InitializeOrphanedStructure(simple.orphanedshapes.internaldafny.types._IOrphanedStructure input) - { - // .NET doesn't have this conversion - // Simple.OrphanedShapes.OrphanedStructure nativeStructure = TypeConversion. - } - - public static simple.orphanedshapes.internaldafny.types._IOrphanedResource InitializeOrphanedStructure(simple.orphanedshapes.internaldafny.types._IOrphanedStructure input) - { - // .NET doesn't have this conversion - // Simple.OrphanedShapes.OrphanedStructure nativeStructure = TypeConversion. - } - - public static simple.orphanedshapes.internaldafny.types._IOrphanedResource InitializeOrphanedStructure(simple.orphanedshapes.internaldafny.types._IOrphanedStructure input) - { - // .NET doesn't have this conversion - // Simple.OrphanedShapes.OrphanedStructure nativeStructure = TypeConversion. - } - } -} \ No newline at end of file diff --git a/TestModels/OrphanedShapes/runtimes/net/Extern/WrappedSimpleOrphanedShapesService.cs b/TestModels/OrphanedShapes/runtimes/net/Extern/WrappedSimpleOrphanedShapesService.cs deleted file mode 100644 index ad93064f5c..0000000000 --- a/TestModels/OrphanedShapes/runtimes/net/Extern/WrappedSimpleOrphanedShapesService.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -using Wrappers_Compile; -using Simple.OrphanedShapes; -using Simple.OrphanedShapes.Wrapped; -using TypeConversion = Simple.OrphanedShapes.TypeConversion; -namespace simple.orphanedshapes.internaldafny.wrapped -{ - public partial class __default - { - public static _IResult WrappedSimpleOrphanedShapes(types._ISimpleOrphanedShapesConfig config) - { - var wrappedConfig = TypeConversion.FromDafny_N6_simple__N14_orphanedShapes__S26_SimpleOrphanedShapesConfig(config); - var impl = new SimpleOrphanedShapes(wrappedConfig); - var wrappedClient = new SimpleOrphanedShapesShim(impl); - return Result.create_Success(wrappedClient); - } - } -} diff --git a/TestModels/OrphanedShapes/runtimes/net/ImplementationFromDafny-cs.dtr b/TestModels/OrphanedShapes/runtimes/net/ImplementationFromDafny-cs.dtr deleted file mode 100644 index 430ea5857d..0000000000 --- a/TestModels/OrphanedShapes/runtimes/net/ImplementationFromDafny-cs.dtr +++ /dev/null @@ -1,14 +0,0 @@ -file_format_version = "1.0" -dafny_version = "4.8.0.0" -[options_by_module.SimpleOrphanedShapesTypes] -legacy-module-names = false -[options_by_module.AbstractSimpleOrphanedShapesOperations] -legacy-module-names = false -[options_by_module.AbstractSimpleOrphanedShapesService] -legacy-module-names = false -[options_by_module.OrphanedResource] -legacy-module-names = false -[options_by_module.SimpleOrphanedShapesImpl] -legacy-module-names = false -[options_by_module.SimpleOrphanedShapes] -legacy-module-names = false diff --git a/TestModels/OrphanedShapes/runtimes/net/SimpleOrphanedShapes.csproj b/TestModels/OrphanedShapes/runtimes/net/SimpleOrphanedShapes.csproj deleted file mode 100644 index 1225ee4f78..0000000000 --- a/TestModels/OrphanedShapes/runtimes/net/SimpleOrphanedShapes.csproj +++ /dev/null @@ -1,29 +0,0 @@ - - - - SimpleOrphanedShapes - disable - disable - net6.0 - 10 - false - - - - - - - - - - - - - - - - - diff --git a/TestModels/OrphanedShapes/runtimes/net/tests/SimpleOrphanedShapesTest.csproj b/TestModels/OrphanedShapes/runtimes/net/tests/SimpleOrphanedShapesTest.csproj deleted file mode 100644 index 04c5ce631d..0000000000 --- a/TestModels/OrphanedShapes/runtimes/net/tests/SimpleOrphanedShapesTest.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - SimpleOrphanedShapesTest - disable - disable - net6.0 - 10 - Exe - false - - - - - - - - - - - - - diff --git a/TestModels/OrphanedShapes/runtimes/net/tests/TestsFromDafny-cs.dtr b/TestModels/OrphanedShapes/runtimes/net/tests/TestsFromDafny-cs.dtr deleted file mode 100644 index 2134b215c8..0000000000 --- a/TestModels/OrphanedShapes/runtimes/net/tests/TestsFromDafny-cs.dtr +++ /dev/null @@ -1,8 +0,0 @@ -file_format_version = "1.0" -dafny_version = "4.8.0.0" -[options_by_module.WrappedAbstractSimpleOrphanedShapesService] -legacy-module-names = false -[options_by_module.WrappedSimpleOrphanedShapesService] -legacy-module-names = false -[options_by_module.WrappedTest] -legacy-module-names = false diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/__init__.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/__init__.py index e69de29bb2..f94fd12a2e 100644 --- a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/__init__.py +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/__init__.py @@ -0,0 +1,2 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/test_externs.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/test_externs.py index db73ea77c1..11575cb399 100644 --- a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/test_externs.py +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/extern/test_externs.py @@ -1,3 +1,6 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + import ExternDefinitions import simple_orphaned import simple_orphaned.smithygenerated.simple_orphaned.deserialize @@ -30,4 +33,4 @@ def CallNativeOrphanedError(dafny_error): dafny_error_again = simple_orphaned.smithygenerated.simple_orphaned.errors._smithy_error_to_dafny_error(native_error) return dafny_error_again -ExternDefinitions.default__ = default__ \ No newline at end of file +ExternDefinitions.default__ = default__ diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs b/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs index 9f0fc49b9c..5fb2e83a65 100644 --- a/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs +++ b/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs @@ -16,13 +16,13 @@ pub mod internal_ExternDefinitions_Compile { pub fn InitializeOrphanedStructure( uninitialized_structure: &Rc, ) -> Rc { - // Rc::clone(uninitialized_structure) + let native_structure = orphaned_structure::from_dafny(uninitialized_structure.clone()); // I don't think generated Rust objects have a "toBuilder" method. // Ideally, this extern would convert the Dafny structure to native, // then set this property on the converted native structure. // But that is sort of outside the scope of this TestModel. - // The fact that the from/to_dafny conversions above and below exist are the important things. + // The important fact is that the from/to_dafny conversions above and below exist. let native_structure_new = crate::types::OrphanedStructure::builder().set_string_value(Some( "the extern MUST use Smithy-generated conversions to set this value in the native structure".to_string() )).build().unwrap(); @@ -33,26 +33,7 @@ pub mod internal_ExternDefinitions_Compile { dafny_resource: &Object, ) -> Rc, Rc>> { - // let cloned_dafny_resource: Object = Rc::new(*dafny_resource.clone()); - // let cloned_dafny_resource: Object = Rc::clone(dafny_resource) as Object; - // let native_resource = orphaned_resource::from_dafny(cloned_dafny_resource).inner.borrow(); - // let cloned_dafny_resource: Object = Rc::new(*Rc::clone(dafny_resource)); - // let native_resource_ref = orphaned_resource::from_dafny(Object(Some(dafny_runtime::rcmut::RcMut::new(Box::new(*dafny_resource) as Box))); - // let native_resource_ref = orphaned_resource::from_dafny(Object::new(Box::new(*dafny_resource) as Box)); - // let native_resource_ref = orphaned_resource::from_dafny(dafny_runtime::Object(*(dafny_resource as &dyn IOrphanedResource))); - - let wrap = crate::conversions::orphaned_resource::IOrphanedResourceDafnyWrapper { - obj: dafny_resource.clone(), - }; - let native_resource_ref = crate::types::orphaned_resource::OrphanedResourceRef { - inner: ::std::rc::Rc::new(::std::cell::RefCell::new(wrap)) - }; - - // let rc_trait_object: Rc> = Rc::new(std::cell::UnsafeCell::new((*dafny_resource))); - // let option_trait_object: Option>> = Some(rc_trait_object); - // let native_resource_ref = orphaned_resource::from_dafny(Object(option_trait_object)); - - + let native_resource_ref = crate::conversions::orphaned_resource::from_dafny(dafny_resource.clone()); let native_resource = native_resource_ref.inner.borrow(); let native_output = native_resource.orphaned_resource_operation( crate::operation::orphaned_resource_operation::OrphanedResourceOperationInput{ @@ -75,7 +56,6 @@ pub mod internal_ExternDefinitions_Compile { pub fn CallNativeOrphanedError( dafny_error: &Rc, ) -> Rc { - // Rc::clone(uninitialized_structure) let native_error = crate::conversions::error::from_dafny(dafny_error.clone()); // I don't think generated Rust objects have a way for me to update the message // on a pre-existing object (i.e. public fields or a .toBuilder). @@ -89,5 +69,4 @@ pub mod internal_ExternDefinitions_Compile { return crate::conversions::error::to_dafny(native_error_new); } } - -} \ No newline at end of file +} diff --git a/TestModels/OrphanedShapes/src/ExternDefinitions.dfy b/TestModels/OrphanedShapes/src/ExternDefinitions.dfy deleted file mode 100644 index f5c8d9dd6c..0000000000 --- a/TestModels/OrphanedShapes/src/ExternDefinitions.dfy +++ /dev/null @@ -1,56 +0,0 @@ -// include "../Model/SimpleOrphanedTypes.dfy" - -// module ExternDefinitions { - -// import opened Wrappers -// import Types = SimpleOrphanedTypes - -// // Dafny-Go compiler maybe-bug: -// // A module needs at least one non-extern method for the Dafny-Go compiler generate the CompanionStruct_Default___ type -// method EmptyMethod() { } - -// // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. -// // This will ensure that OrphanedStructure and its conversions are generated, -// // even though OrphanedStructure is "orphaned". - -// // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. -// // The Smithy model does not know about this operation, -// // so it doesn't register OrphanedStructure as an operation shape. -// // If this operation were on the Smithy model, -// // both the operation and OrphanedStructure would no longer be orphaned, -// // and wouldn't be useful in an "orphaned shapes" TestModel. -// // Putting all usage of the orphaned shape outside the model's knowledge -// // lets us test orphaned shape model/conversion generation. -// method {:extern} InitializeOrphanedStructure( input: Types.OrphanedStructure ) -// returns (output: Types.OrphanedStructure) - -// // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. -// // This will ensure that OrphanedStructure and its conversions are generated, -// // even though OrphanedStructure is "orphaned". - -// // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. -// // The Smithy model does not know about this operation, -// // so it doesn't register OrphanedStructure as an operation shape. -// // If this operation were on the Smithy model, -// // both the operation and OrphanedStructure would no longer be orphaned, -// // and wouldn't be useful in an "orphaned shapes" TestModel. -// // Putting all usage of the orphaned shape outside the model's knowledge -// // lets us test orphaned shape model/conversion generation. -// method {:extern} CallNativeOrphanedResource( input: Types.IOrphanedResource ) -// returns (output: Result) - -// // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. -// // This will ensure that OrphanedStructure and its conversions are generated, -// // even though OrphanedStructure is "orphaned". - -// // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. -// // The Smithy model does not know about this operation, -// // so it doesn't register OrphanedStructure as an operation shape. -// // If this operation were on the Smithy model, -// // both the operation and OrphanedStructure would no longer be orphaned, -// // and wouldn't be useful in an "orphaned shapes" TestModel. -// // Putting all usage of the orphaned shape outside the model's knowledge -// // lets us test orphaned shape model/conversion generation. -// method {:extern} CallNativeOrphanedError( input: Types.Error ) -// returns (output: Types.Error ) -// } \ No newline at end of file diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy index c0378f39d2..e8f2d6a191 100644 --- a/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy +++ b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy @@ -2,11 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 include "../Model/SimpleOrphanedTypes.dfy" include "OrphanedResource.dfy" -include "ExternDefinitions.dfy" module SimpleOrphanedImpl refines AbstractSimpleOrphanedOperations { - // import OrphanedResource - // import ExternDefinitions datatype Config = Config type InternalConfig = Config @@ -14,49 +11,4 @@ module SimpleOrphanedImpl refines AbstractSimpleOrphanedOperations { {true} function ModifiesInternalConfig(config: InternalConfig) : set {{}} - // predicate CreateOrphanedStructureEnsuresPublicly(input: CreateOrphanedStructureInput, output: Result) { - // true - // } - // predicate CreateOrphanedResourceEnsuresPublicly(input: CreateOrphanedResourceInput, output: Result) { - // true - // } - // predicate CreateOrphanedErrorEnsuresPublicly(input: CreateOrphanedErrorInput, output: Result) { - // true - // } - // method CreateOrphanedStructure ( config: InternalConfig, input: CreateOrphanedStructureInput ) - // returns (output: Result) - // { - // // Create Dafny OrphanedStructure. (This implicitly tests Dafny codegen's orphaned shapes generation.) - // var uninitializedStructure := Types.OrphanedStructure(); - // var initializedStructure := ExternDefinitions.InitializeOrphanedStructure(uninitializedStructure); - - // expect initializedStructure.stringValue.Some?; - // expect initializedStructure.stringValue.value == "the extern MUST use Smithy-generated conversions to set this value in the native structure"; - - // return Success(CreateOrphanedStructureOutput()); - // } - - // method CreateOrphanedResource ( config: InternalConfig, input: CreateOrphanedResourceInput ) - // returns (output: Result) - // { - // var resource := new OrphanedResource.OrphanedResource(); - // var ret :- ExternDefinitions.CallNativeOrphanedResource(resource); - - // expect ret.someString.Some?; - // expect ret.someString.value == "correct string"; - - // return Success(CreateOrphanedResourceOutput()); - // } - - // method CreateOrphanedError ( config: InternalConfig, input: CreateOrphanedErrorInput ) - // returns (output: Result) - // { - // var error := Types.Error.OrphanedError(message := "TBD"); - // var out_error := ExternDefinitions.CallNativeOrphanedError(error); - - // expect out_error.OrphanedError?; - // expect out_error.message == "the extern MUST use Smithy-generated conversions to set this value in the native error"; - - // return Success(CreateOrphanedErrorOutput()); - // } } \ No newline at end of file diff --git a/TestModels/OrphanedShapes/test/ExternDefinitions.dfy b/TestModels/OrphanedShapes/test/ExternDefinitions.dfy index 94dccd533c..1805d0788e 100644 --- a/TestModels/OrphanedShapes/test/ExternDefinitions.dfy +++ b/TestModels/OrphanedShapes/test/ExternDefinitions.dfy @@ -9,7 +9,6 @@ module {:extern} ExternDefinitions { method TestOrphanedStructure () { - // Create Dafny OrphanedStructure. (This implicitly tests Dafny codegen's orphaned shapes generation.) var uninitializedStructure := Types.OrphanedStructure(); var initializedStructure := InitializeOrphanedStructure(uninitializedStructure); @@ -51,33 +50,16 @@ module {:extern} ExternDefinitions { method {:extern} InitializeOrphanedStructure( input: Types.OrphanedStructure ) returns (output: Types.OrphanedStructure) - // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. - // This will ensure that OrphanedStructure and its conversions are generated, - // even though OrphanedStructure is "orphaned". - - // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. - // The Smithy model does not know about this operation, - // so it doesn't register OrphanedStructure as an operation shape. - // If this operation were on the Smithy model, - // both the operation and OrphanedStructure would no longer be orphaned, - // and wouldn't be useful in an "orphaned shapes" TestModel. - // Putting all usage of the orphaned shape outside the model's knowledge - // lets us test orphaned shape model/conversion generation. + // This extern MUST use Smithy-generated type conversions to call the operation on the native OrphanedResource. + // This will ensure that OrphanedResource and its conversions are generated, + // even though OrphanedResource is "orphaned". method {:extern} CallNativeOrphanedResource( input: Types.IOrphanedResource ) returns (output: Result) - // This extern MUST use Smithy-generated type conversions to initialize the input in the native OrphanedStructure. - // This will ensure that OrphanedStructure and its conversions are generated, - // even though OrphanedStructure is "orphaned". - - // OrphanedStructure is orphaned because InitializeOrphanedStructure is not a modelled operation. - // The Smithy model does not know about this operation, - // so it doesn't register OrphanedStructure as an operation shape. - // If this operation were on the Smithy model, - // both the operation and OrphanedStructure would no longer be orphaned, - // and wouldn't be useful in an "orphaned shapes" TestModel. - // Putting all usage of the orphaned shape outside the model's knowledge - // lets us test orphaned shape model/conversion generation. + // This extern MUST use Smithy-generated type conversions to convert the Dafny error to/from native. + // In particular, the extern MUST use the catch-all/common error handler for this conversion. + // The extern MUST NOT use some error handler specific to OrphanedError. + // This will ensure that orphaned errors are handled in the catch-all/common error handler. method {:extern} CallNativeOrphanedError( input: Types.Error ) returns (output: Types.Error ) } \ No newline at end of file diff --git a/TestModels/OrphanedShapes/test/WrappedTest.dfy b/TestModels/OrphanedShapes/test/WrappedTest.dfy index f9c6a493a2..ded4b88f01 100644 --- a/TestModels/OrphanedShapes/test/WrappedTest.dfy +++ b/TestModels/OrphanedShapes/test/WrappedTest.dfy @@ -5,26 +5,14 @@ include "../src/WrappedSimpleOrphanedImpl.dfy" include "ExternDefinitions.dfy" // There are no non-wrapped tests for this TestModel. -// This TestModel requires implementing externs that call Polymorph-generated code. -// Polymorph must be in the mix, even for the non-wrapped client, so it is reasonable to only have wrapped tests. +// This TestModel requires implementing externs that use Polymorph-generated code. +// Polymorph must be in the mix, so it is reasonable to only have wrapped tests. module WrappedTest { import WrappedSimpleOrphanedService import opened Types = SimpleOrphanedTypes import ExternDefinitions - // method {:test} TestWrappedClient() - // { - // // ExternDefinitions.TestOrphanedStructure(); - // ExternDefinitions.TestOrphanedResource(); - // // ExternDefinitions.TestOrphanedError(); - - // // var client :- expect WrappedSimpleOrphanedService.WrappedSimpleOrphaned(); - // // TestCreateOrphanedStructure(client); - // // TestCreateOrphanedResource(client); - // // TestCreateOrphanedError(client); - // } - method {:test} TestOrphanedStructure() { ExternDefinitions.TestOrphanedStructure(); } diff --git a/TestModels/RecursiveShape/Model/RecursiveShape.smithy b/TestModels/RecursiveShape/Model/RecursiveShape.smithy index d6635c6e89..ab2cb7ae2d 100644 --- a/TestModels/RecursiveShape/Model/RecursiveShape.smithy +++ b/TestModels/RecursiveShape/Model/RecursiveShape.smithy @@ -45,4 +45,4 @@ map MapWithRecursion { structure StructureWithRecursion { content: RecursiveUnion -} +} \ No newline at end of file From 20cc1669b5779bcc9d27398a877215eda6a69061 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 14:52:25 -0800 Subject: [PATCH 22/32] m --- .../extern/wrapped_simple_blob.py | 6 +---- .../test/internaldafny/test_dafny_wrapper.py | 9 ++++---- .../net/ImplementationFromDafny-cs.dtr | 7 +----- ...fnyLocalServiceTypeConversionProtocol.java | 23 ++----------------- 4 files changed, 8 insertions(+), 37 deletions(-) diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/extern/wrapped_simple_blob.py b/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/extern/wrapped_simple_blob.py index 3d25facaa1..b6172afab0 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/extern/wrapped_simple_blob.py +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/extern/wrapped_simple_blob.py @@ -4,15 +4,12 @@ # src imports from simple_types_blob.smithygenerated.simple_types_blob.client import SimpleTypesBlob from simple_types_blob.smithygenerated.simple_types_blob.shim import SimpleBlobShim -from simple_types_blob.smithygenerated.simple_types_blob.config import ( - dafny_config_to_smithy_config, -) +from simple_types_blob.smithygenerated.simple_types_blob.config import dafny_config_to_smithy_config import smithy_dafny_standard_library.internaldafny.generated.Wrappers as Wrappers # test imports, not qualified since this isn't in a package import WrappedSimpleTypesBlobService - class default__(WrappedSimpleTypesBlobService.default__): @staticmethod @@ -22,5 +19,4 @@ def WrappedSimpleBlob(config): wrapped_client = SimpleBlobShim(impl) return Wrappers.Result_Success(wrapped_client) - WrappedSimpleTypesBlobService.default__ = default__ diff --git a/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/test_dafny_wrapper.py b/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/test_dafny_wrapper.py index bc7aa6a427..12c830fb4c 100644 --- a/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/test_dafny_wrapper.py +++ b/TestModels/SimpleTypes/SimpleBlob/runtimes/python/test/internaldafny/test_dafny_wrapper.py @@ -1,5 +1,5 @@ -"""Wrapper file for executing Dafny tests from pytest. - +""" +Wrapper file for executing Dafny tests from pytest. This allows us to import modules required by Dafny-generated tests before executing Dafny-generated tests. pytest will find and execute the `test_dafny` method below, @@ -12,7 +12,7 @@ # and require adding Dafny-generated test code to PYTHONPATH. # These files are only on PYTHONPATH for tests executed from this file. -internaldafny_dir = "/".join(__file__.split("/")[:-1]) +internaldafny_dir = '/'.join(__file__.split("/")[:-1]) sys.path.append(internaldafny_dir + "/extern") sys.path.append(internaldafny_dir + "/generated") @@ -20,6 +20,5 @@ # Initialize extern for test from .extern import wrapped_simple_blob - def test_dafny(): - from .generated import __main__ + from .generated import __main__ \ No newline at end of file diff --git a/TestModels/dafny-dependencies/StandardLibrary/runtimes/net/ImplementationFromDafny-cs.dtr b/TestModels/dafny-dependencies/StandardLibrary/runtimes/net/ImplementationFromDafny-cs.dtr index 6bed40cf02..59d33d478c 100644 --- a/TestModels/dafny-dependencies/StandardLibrary/runtimes/net/ImplementationFromDafny-cs.dtr +++ b/TestModels/dafny-dependencies/StandardLibrary/runtimes/net/ImplementationFromDafny-cs.dtr @@ -1,12 +1,7 @@ file_format_version = "1.0" -dafny_version = "4.8.0.0" +dafny_version = "4.7.0.0" [options_by_module.Wrappers] -legacy-module-names = false [options_by_module."StandardLibrary.UInt"] -legacy-module-names = false [options_by_module.StandardLibrary] -legacy-module-names = false [options_by_module.UTF8] -legacy-module-names = false [options_by_module.StandardLibraryInterop] -legacy-module-names = false diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java index b35fe295c5..7933798962 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/localservice/DafnyLocalServiceTypeConversionProtocol.java @@ -7,8 +7,6 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.Set; -import java.util.stream.Collectors; - import software.amazon.polymorph.smithygo.codegen.ApplicationProtocol; import software.amazon.polymorph.smithygo.codegen.GenerationContext; import software.amazon.polymorph.smithygo.codegen.GoDelegator; @@ -26,7 +24,6 @@ import software.amazon.polymorph.traits.LocalServiceTrait; import software.amazon.polymorph.traits.PositionalTrait; import software.amazon.polymorph.traits.ReferenceTrait; -import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.aws.traits.ServiceTrait; import software.amazon.smithy.codegen.core.Symbol; import software.amazon.smithy.model.shapes.OperationShape; @@ -1069,13 +1066,6 @@ func OpaqueError_Input_ToDafny(nativeInput $L.OpaqueError)($L.Error) { } ); - Set errorShapesForNamespace = context.model().getStructureShapes() - .stream() - .filter(shape -> shape.hasTrait(ErrorTrait.class)) - .filter(shape -> - ModelUtils.isInServiceNamespace(shape.getId(), context.settings().getService(context.model()))) - .collect(Collectors.toSet()); - context .writerDelegator() .useFileWriter( @@ -1113,8 +1103,7 @@ func Error_ToDafny(err error)($L.Error) { """, DafnyNameResolver.dafnyTypesNamespace(serviceShape), writer.consumer(w -> { - for (var errorShape : errorShapesForNamespace) { - var error = errorShape.getId(); + for (var error : serviceShape.getErrors()) { w.write( """ case $L: @@ -1435,13 +1424,6 @@ func OpaqueError_Output_FromDafny(dafnyOutput $L.Error)($L.OpaqueError) { } ); - Set errorShapesForNamespace = context.model().getStructureShapes() - .stream() - .filter(shape -> shape.hasTrait(ErrorTrait.class)) - .filter(shape -> - ModelUtils.isInServiceNamespace(shape.getId(), context.settings().getService(context.model()))) - .collect(Collectors.toSet()); - context .writerDelegator() .useFileWriter( @@ -1474,8 +1456,7 @@ func Error_FromDafny(err $L.Error)(error) { """, DafnyNameResolver.dafnyTypesNamespace(serviceShape), writer.consumer(w -> { - for (final var errorShape : errorShapesForNamespace) { - var error = errorShape.getId(); + for (final var error : serviceShape.getErrors()) { w.write( """ if err.Is_$L() { From a1af5849c6efbea685c720616e8e68b33cedb05b Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 14:53:52 -0800 Subject: [PATCH 23/32] m --- .../runtimes/rust/src/wrapped.rs | 15 ----- .../runtimes/rust/src/wrapped/client.rs | 61 ------------------- 2 files changed, 76 deletions(-) delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/wrapped.rs delete mode 100644 TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped.rs b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped.rs deleted file mode 100644 index 26b4d6f29e..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -pub mod client; - -impl crate::r#simple::orphaned::internaldafny::wrapped::_default { - pub fn WrappedSimpleOrphaned(config: &::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, - >) -> ::std::rc::Rc, - ::std::rc::Rc - >>{ - crate::wrapped::client::Client::from_conf(config) - } -} diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs b/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs deleted file mode 100644 index d17c62c786..0000000000 --- a/TestModels/OrphanedShapes/runtimes/rust/src/wrapped/client.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 -// Do not modify this file. This file is machine generated, and any changes to it will be overwritten. -use std::sync::LazyLock; - -pub struct Client { - wrapped: crate::client::Client -} - -/// A runtime for executing operations on the asynchronous client in a blocking manner. -/// Necessary because Dafny only generates synchronous code. -static dafny_tokio_runtime: LazyLock = LazyLock::new(|| { - tokio::runtime::Builder::new_multi_thread() - .enable_all() - .build() - .unwrap() -}); - -impl dafny_runtime::UpcastObject for Client { - ::dafny_runtime::UpcastObjectFn!(dyn crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient); -} - -impl dafny_runtime::UpcastObject for Client { - ::dafny_runtime::UpcastObjectFn!(dyn ::std::any::Any); -} - -impl Client { - pub fn from_conf(config: &::std::rc::Rc< - crate::r#simple::orphaned::internaldafny::types::SimpleOrphanedConfig, - >) -> -::std::rc::Rc, - ::std::rc::Rc ->> { - let result = crate::client::Client::from_conf( - crate::conversions::simple_orphaned_config::_simple_orphaned_config::from_dafny( - config.clone(), - ), - ); - match result { - Ok(client) => { - let wrap = crate::wrapped::client::Client { - wrapped: client - }; - std::rc::Rc::new( - crate::_Wrappers_Compile::Result::Success { - value: ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(wrap)) - } - ) - }, - Err(error) => { - let msg = format!("{:?}", error); - crate::conversions::error::to_opaque_error_result(msg) - } - } - } -} - -impl crate::r#simple::orphaned::internaldafny::types::ISimpleOrphanedClient for Client { - -} From f8eaf5e8cf4b953962c22c5b785370af2210a61e Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 15:22:26 -0800 Subject: [PATCH 24/32] m --- .../shapevisitor/conversionwriter/BaseConversionWriter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java index 6c1a578cf9..ba5012fd07 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java @@ -7,6 +7,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; + +import software.amazon.polymorph.smithypython.awssdk.nameresolver.AwsSdkNameResolver; import software.amazon.polymorph.smithypython.wrappedlocalservice.DafnyPythonWrappedLocalServiceProtocolGenerator; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.StringShape; @@ -133,7 +135,7 @@ protected abstract void writeStringEnumShapeConverter( * Returns true if a conversion function should be written for the shape, false otherwise. * Conversion functions are only written for "complex" shapes: * - StructureShapes ("complex" because StructureShapes can be recursive) - * - except for StructureShapes with ErrorTrait; these aren't "complex" + * - except for non-AWS SDK StructureShapes with ErrorTrait; these aren't "complex" * - UnionShapes ("complex" because the conversion is not a one-liner) * - EnumShapes or StringShapes with EnumTrait ("complex" because the conversion is not a one-liner) * @param shape @@ -141,7 +143,7 @@ protected abstract void writeStringEnumShapeConverter( */ public static boolean shapeShouldHaveConversionFunction(Shape shape) { if (shape.isStructureShape()) { - if (shape.hasTrait(ErrorTrait.class)) { + if (!AwsSdkNameResolver.isAwsSdkShape(shape) && shape.hasTrait(ErrorTrait.class)) { return false; } return true; From b4bb57a67847f0943e5faf295bd2ac148778699d Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 15:25:13 -0800 Subject: [PATCH 25/32] format --- TestModels/OrphanedShapes/README.md | 2 + .../BaseConversionWriter.java | 11 ++- ...irectedDafnyPythonLocalServiceCodegen.java | 73 ++++++++++--------- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/TestModels/OrphanedShapes/README.md b/TestModels/OrphanedShapes/README.md index 8b27003b0f..d80119f35c 100644 --- a/TestModels/OrphanedShapes/README.md +++ b/TestModels/OrphanedShapes/README.md @@ -7,6 +7,7 @@ This project tests for support of "orphaned" shapes. An "orphaned" is a shape that exists in a Smithy model, but is not discovered by Smithy-Core's shape discovery logic. Smithy-Core will only discover and generate code for shapes that are attached to a service via the service's + 1. Operations 2. Mixins 3. Errors @@ -43,6 +44,7 @@ and these TestModels' prerequisite TestModels. ## Coverage This TestModel tests some instances of orphaned shapes + - LocalService Config shapes. (Config shapes are "orphaned", but are likely already handled as one-offs by any codegen that's this TestModels' prerequisites) - Errors - Resources (with @aws.polymorph#reference trait) and their operations diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java index ba5012fd07..c467850e23 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/common/shapevisitor/conversionwriter/BaseConversionWriter.java @@ -7,7 +7,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; - import software.amazon.polymorph.smithypython.awssdk.nameresolver.AwsSdkNameResolver; import software.amazon.polymorph.smithypython.wrappedlocalservice.DafnyPythonWrappedLocalServiceProtocolGenerator; import software.amazon.smithy.model.shapes.Shape; @@ -143,15 +142,19 @@ protected abstract void writeStringEnumShapeConverter( */ public static boolean shapeShouldHaveConversionFunction(Shape shape) { if (shape.isStructureShape()) { - if (!AwsSdkNameResolver.isAwsSdkShape(shape) && shape.hasTrait(ErrorTrait.class)) { + if ( + !AwsSdkNameResolver.isAwsSdkShape(shape) && + shape.hasTrait(ErrorTrait.class) + ) { return false; } return true; } else if (shape.isUnionShape()) { return true; } else if ( - (shape.isStringShape() && shape.hasTrait(EnumTrait.class)) - || shape.isEnumShape()) { + (shape.isStringShape() && shape.hasTrait(EnumTrait.class)) || + shape.isEnumShape() + ) { return true; } return false; diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 2b1545c366..8461c4fcd4 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -4,9 +4,8 @@ package software.amazon.polymorph.smithypython.localservice.extensions; import static java.lang.String.format; -import static software.amazon.polymorph.utils.ModelUtils.getTopologicallyOrderedOrphanedShapesForService; import static software.amazon.polymorph.smithypython.common.shapevisitor.conversionwriter.BaseConversionWriter.shapeShouldHaveConversionFunction; - +import static software.amazon.polymorph.utils.ModelUtils.getTopologicallyOrderedOrphanedShapesForService; import java.nio.file.Path; import java.util.List; @@ -535,34 +534,34 @@ protected void generateOrphanedShapesForService( shapeToGenerate ); } -// -// final WriterDelegator delegator = directive.context().writerDelegator(); -// final String moduleName = -// SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( -// directive.context().settings().getService().getNamespace() -// ); -// -// delegator.useFileWriter( -// moduleName + "/dafny_to_smithy.py", -// "", -// conversionWriter -> { -// DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( -// shapeToGenerate, -// directive.context(), -// conversionWriter -// ); -// }); -// -// delegator.useFileWriter( -// moduleName + "/smithy_to_dafny.py", -// "", -// conversionWriter -> { -// LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( -// shapeToGenerate, -// directive.context(), -// conversionWriter -// ); -// }); + // + // final WriterDelegator delegator = directive.context().writerDelegator(); + // final String moduleName = + // SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( + // directive.context().settings().getService().getNamespace() + // ); + // + // delegator.useFileWriter( + // moduleName + "/dafny_to_smithy.py", + // "", + // conversionWriter -> { + // DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( + // shapeToGenerate, + // directive.context(), + // conversionWriter + // ); + // }); + // + // delegator.useFileWriter( + // moduleName + "/smithy_to_dafny.py", + // "", + // conversionWriter -> { + // LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( + // shapeToGenerate, + // directive.context(), + // conversionWriter + // ); + // }); } } @@ -582,10 +581,10 @@ protected void generateOrphanedShapeConversionMethods( ); for (Shape shapeToGenerate : orderedShapes) { - - if (shapeShouldHaveConversionFunction(shapeToGenerate)) - { - final WriterDelegator delegator = directive.context().writerDelegator(); + if (shapeShouldHaveConversionFunction(shapeToGenerate)) { + final WriterDelegator delegator = directive + .context() + .writerDelegator(); final String moduleName = SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( directive.context().settings().getService().getNamespace() @@ -600,7 +599,8 @@ protected void generateOrphanedShapeConversionMethods( directive.context(), conversionWriter ); - }); + } + ); delegator.useFileWriter( moduleName + "/smithy_to_dafny.py", @@ -611,7 +611,8 @@ protected void generateOrphanedShapeConversionMethods( directive.context(), conversionWriter ); - }); + } + ); } } } From 4e39e8c43d58f7f2824a84ed8d46a5d1d4440c79 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 15:28:21 -0800 Subject: [PATCH 26/32] (c) --- .../src/test/java/ExternDefinitions_Compile/__default.java | 4 ++-- .../runtimes/python/test/internaldafny/test_dafny_wrapper.py | 3 +++ .../OrphanedShapes/runtimes/rust/src/extern_definitions.rs | 3 +++ TestModels/OrphanedShapes/src/Index.dfy | 1 + TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy | 1 + TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy | 1 + TestModels/OrphanedShapes/test/ExternDefinitions.dfy | 3 +++ 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/TestModels/OrphanedShapes/runtimes/java/src/test/java/ExternDefinitions_Compile/__default.java b/TestModels/OrphanedShapes/runtimes/java/src/test/java/ExternDefinitions_Compile/__default.java index 8f487931d7..29c7a4ad28 100644 --- a/TestModels/OrphanedShapes/runtimes/java/src/test/java/ExternDefinitions_Compile/__default.java +++ b/TestModels/OrphanedShapes/runtimes/java/src/test/java/ExternDefinitions_Compile/__default.java @@ -1,5 +1,5 @@ -// Class _ExternBase___default -// Dafny class __default compiled into Java +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 package ExternDefinitions_Compile; import simple.orphaned.internaldafny.types.*; diff --git a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py index 7149e282b4..ec829826cb 100644 --- a/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py +++ b/TestModels/OrphanedShapes/runtimes/python/test/internaldafny/test_dafny_wrapper.py @@ -1,3 +1,6 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + """ Wrapper file for executing Dafny tests from pytest. This allows us to import modules required by Dafny-generated tests diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs b/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs index 5fb2e83a65..28b25bd7c1 100644 --- a/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs +++ b/TestModels/OrphanedShapes/runtimes/rust/src/extern_definitions.rs @@ -1,3 +1,6 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + use std::rc::Rc; use std::cell::UnsafeCell; use dafny_runtime::rcmut; diff --git a/TestModels/OrphanedShapes/src/Index.dfy b/TestModels/OrphanedShapes/src/Index.dfy index 2fe489ca2f..1a5eb698c1 100644 --- a/TestModels/OrphanedShapes/src/Index.dfy +++ b/TestModels/OrphanedShapes/src/Index.dfy @@ -1,5 +1,6 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 + include "SimpleOrphanedImpl.dfy" module {:extern "simple.orphaned.internaldafny" } SimpleOrphaned refines AbstractSimpleOrphanedService { diff --git a/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy index e8f2d6a191..c8e2fd85b1 100644 --- a/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy +++ b/TestModels/OrphanedShapes/src/SimpleOrphanedImpl.dfy @@ -1,5 +1,6 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 + include "../Model/SimpleOrphanedTypes.dfy" include "OrphanedResource.dfy" diff --git a/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy index db9896c073..a1efc8ddb6 100644 --- a/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy +++ b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy @@ -1,5 +1,6 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 + include "../Model/SimpleOrphanedTypesWrapped.dfy" module {:options "--function-syntax:4"} {:extern "simple.orphaned.internaldafny.wrapped"} WrappedSimpleOrphanedService refines WrappedAbstractSimpleOrphanedService { diff --git a/TestModels/OrphanedShapes/test/ExternDefinitions.dfy b/TestModels/OrphanedShapes/test/ExternDefinitions.dfy index 1805d0788e..6d91d33919 100644 --- a/TestModels/OrphanedShapes/test/ExternDefinitions.dfy +++ b/TestModels/OrphanedShapes/test/ExternDefinitions.dfy @@ -1,3 +1,6 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + include "../Model/SimpleOrphanedTypes.dfy" include "../src/OrphanedResource.dfy" From a049cd77bcbc2a63eb13e3c5fc38bea0171c3337 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 15:29:44 -0800 Subject: [PATCH 27/32] 311 --- TestModels/OrphanedShapes/runtimes/python/tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestModels/OrphanedShapes/runtimes/python/tox.ini b/TestModels/OrphanedShapes/runtimes/python/tox.ini index 56e7f688e3..b626d2496c 100644 --- a/TestModels/OrphanedShapes/runtimes/python/tox.ini +++ b/TestModels/OrphanedShapes/runtimes/python/tox.ini @@ -1,7 +1,7 @@ [tox] isolated_build = True envlist = - py{312} + py{311,312} [testenv] skip_install = true From 1f91128e60d02b4078c04b1f118328cc72890463 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 15:44:41 -0800 Subject: [PATCH 28/32] m --- TestModels/OrphanedShapes/src/Index.dfy | 1 - TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy | 1 - 2 files changed, 2 deletions(-) diff --git a/TestModels/OrphanedShapes/src/Index.dfy b/TestModels/OrphanedShapes/src/Index.dfy index 1a5eb698c1..2fe489ca2f 100644 --- a/TestModels/OrphanedShapes/src/Index.dfy +++ b/TestModels/OrphanedShapes/src/Index.dfy @@ -1,6 +1,5 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 - include "SimpleOrphanedImpl.dfy" module {:extern "simple.orphaned.internaldafny" } SimpleOrphaned refines AbstractSimpleOrphanedService { diff --git a/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy index a1efc8ddb6..db9896c073 100644 --- a/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy +++ b/TestModels/OrphanedShapes/src/WrappedSimpleOrphanedImpl.dfy @@ -1,6 +1,5 @@ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 - include "../Model/SimpleOrphanedTypesWrapped.dfy" module {:options "--function-syntax:4"} {:extern "simple.orphaned.internaldafny.wrapped"} WrappedSimpleOrphanedService refines WrappedAbstractSimpleOrphanedService { From 54ef386884ac43acd45ee38f73318f3e484bdf49 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 16:26:09 -0800 Subject: [PATCH 29/32] m --- ...irectedDafnyPythonLocalServiceCodegen.java | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 8461c4fcd4..f761c50305 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -534,35 +534,6 @@ protected void generateOrphanedShapesForService( shapeToGenerate ); } - // - // final WriterDelegator delegator = directive.context().writerDelegator(); - // final String moduleName = - // SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( - // directive.context().settings().getService().getNamespace() - // ); - // - // delegator.useFileWriter( - // moduleName + "/dafny_to_smithy.py", - // "", - // conversionWriter -> { - // DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( - // shapeToGenerate, - // directive.context(), - // conversionWriter - // ); - // }); - // - // delegator.useFileWriter( - // moduleName + "/smithy_to_dafny.py", - // "", - // conversionWriter -> { - // LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( - // shapeToGenerate, - // directive.context(), - // conversionWriter - // ); - // }); - } } From f2488ce2cc061b45135479bda553d3609649ff56 Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 16:29:33 -0800 Subject: [PATCH 30/32] m --- ...irectedDafnyPythonLocalServiceCodegen.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index f761c50305..2544ab9a50 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -534,6 +534,35 @@ protected void generateOrphanedShapesForService( shapeToGenerate ); } + + final WriterDelegator delegator = directive.context().writerDelegator(); + final String moduleName = + SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( + directive.context().settings().getService().getNamespace() + ); + + delegator.useFileWriter( + moduleName + "/dafny_to_smithy.py", + "", + conversionWriter -> { + DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + + delegator.useFileWriter( + moduleName + "/smithy_to_dafny.py", + "", + conversionWriter -> { + LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( + shapeToGenerate, + directive.context(), + conversionWriter + ); + }); + } } From 5dc62965ae0575b60d46cdbdf8d5aace9ed42aec Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Wed, 11 Dec 2024 16:34:35 -0800 Subject: [PATCH 31/32] m --- ...irectedDafnyPythonLocalServiceCodegen.java | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java index 2544ab9a50..f761c50305 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithypython/localservice/extensions/DirectedDafnyPythonLocalServiceCodegen.java @@ -534,35 +534,6 @@ protected void generateOrphanedShapesForService( shapeToGenerate ); } - - final WriterDelegator delegator = directive.context().writerDelegator(); - final String moduleName = - SmithyNameResolver.getServiceSmithygeneratedDirectoryNameForNamespace( - directive.context().settings().getService().getNamespace() - ); - - delegator.useFileWriter( - moduleName + "/dafny_to_smithy.py", - "", - conversionWriter -> { - DafnyToLocalServiceConversionFunctionWriter.writeConverterForShapeAndMembers( - shapeToGenerate, - directive.context(), - conversionWriter - ); - }); - - delegator.useFileWriter( - moduleName + "/smithy_to_dafny.py", - "", - conversionWriter -> { - LocalServiceToDafnyConversionFunctionWriter.writeConverterForShapeAndMembers( - shapeToGenerate, - directive.context(), - conversionWriter - ); - }); - } } From c93de721ce020dd04ccf0b5c71e0d94a539de34c Mon Sep 17 00:00:00 2001 From: Lucas McDonald Date: Tue, 7 Jan 2025 11:14:26 -0800 Subject: [PATCH 32/32] validation --- TestModels/OrphanedShapes/runtimes/rust/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs b/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs index 650eef6eb0..e59d292e28 100644 --- a/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs +++ b/TestModels/OrphanedShapes/runtimes/rust/src/lib.rs @@ -14,6 +14,7 @@ pub mod error; pub(crate) mod implementation_from_dafny; /// All operations that this crate can perform. pub mod operation; +pub mod validation; mod standard_library_conversions; mod standard_library_externs; pub mod types;