Skip to content

Commit

Permalink
auto commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rishav-karanjit committed Jan 16, 2025
1 parent 24d0ac9 commit 30fa504
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ 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
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2
github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.0
)

replace github.com/dafny-lang/DafnyStandardLibGo => ../../../../dafny-dependencies/StandardLibrary/runtimes/go/ImplementationFromDafny-go/
replace github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library => ../../../../dafny-dependencies/StandardLibrary/runtimes/go/ImplementationFromDafny-go/
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package ExternDefinitions

import (
"fmt"

Wrappers "github.com/dafny-lang/DafnyStandardLibGo/Wrappers"
Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/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"
Expand All @@ -12,12 +10,16 @@ import (

var _ Wrappers.Dummy__

// TODO: Finish implementation.
// This is missing structure converter.
// TODO: Remove this once Dafny bug is fixed.
// Dafny bug: https://t.corp.amazon.com/9a9028fd-2711-4843-b8f0-09965f7e61a7/communication#f03694be-7410-47f9-866d-e43093b018f9
var m_ExternDefinitions = CompanionStruct_Default___{}

func (CompanionStruct_Default___) InitializeOrphanedStructure(input SimpleOrphanedTypes.OrphanedStructure) SimpleOrphanedTypes.OrphanedStructure {
// Missing Structure converter
return input
nativeInput := simpleorphanedsmithygenerated.OrphanedStructure_FromDafny(input)
stringToReplace := "the extern MUST use Smithy-generated conversions to set this value in the native structure"
nativeInput.StringValue = &stringToReplace
dafnyInitializedStructure := simpleorphanedsmithygenerated.OrphanedStructure_ToDafny(nativeInput)
return dafnyInitializedStructure
}

func (CompanionStruct_Default___) CallNativeOrphanedResource(input *OrphanedResource.OrphanedResource) Wrappers.Result {
Expand All @@ -32,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 := simpleorphanedsmithygenerated.Error_FromDafny(input).(simpleorphanedsmithygeneratedtypes.OrphanedError)
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ 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/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library v0.0.0
github.com/dafny-lang/DafnyRuntimeGo/v4 v4.9.2
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/
replace github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library => ../../../../dafny-dependencies/StandardLibrary/runtimes/go/ImplementationFromDafny-go/
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void generateSerializers(final GenerationContext context) {
final var resource = refResource
.expectTrait(ReferenceTrait.class)
.getReferentId();
alreadyVisited.add(resource);
alreadyVisited.add(refResource.toShapeId());
if (!refResource.expectTrait(ReferenceTrait.class).isService()) {
final var resourceShape = model.expectShape(
resource,
Expand Down Expand Up @@ -473,7 +473,7 @@ public void generateOrphanShapeSerializer(
.expectShape(referenceTrait.getReferentId());
if (resourceOrService.isResourceShape()) {
throw new IllegalStateException(
"Reference to resource shapes are already handled in generateDeserializers function."
"Reference to resource shapes are already handled in generateSerializers function."
);
}
if (resourceOrService.hasTrait(ServiceTrait.class)) {
Expand Down Expand Up @@ -716,7 +716,7 @@ public void generateDeserializers(final GenerationContext context) {
final var resource = refResource
.expectTrait(ReferenceTrait.class)
.getReferentId();
alreadyVisited.add(resource);
alreadyVisited.add(refResource.toShapeId());
if (!refResource.expectTrait(ReferenceTrait.class).isService()) {
final var resourceShape = context
.model()
Expand Down

0 comments on commit 30fa504

Please sign in to comment.