Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat): Add Positional Trait in Go codegen #7

Open
wants to merge 49 commits into
base: scchatur/GoCodegen
Choose a base branch
from

Conversation

rishav-karanjit
Copy link
Collaborator

No description provided.

@rishav-karanjit rishav-karanjit marked this pull request as ready for review August 19, 2024 20:06
return dereferencableShapes.contains(shape.toShapeId());
}
}
package software.amazon.polymorph.smithygo.codegen.knowledge;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened here? Why the whole file is in the diff??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diff will go away once I merge new changes to this PR.

@@ -141,10 +144,20 @@ func NewClient(clientConfig $L) (*$T, error) {
if (inputShape.hasTrait(UnitTypeTrait.class)) {
baseClientCall = "var dafny_response = client.DafnyClient.%s()".formatted(operationShape.getId().getName());
} else {
String dafnyType;
if (inputShape.hasTrait(PositionalTrait.class)) {
Shape inputForPositional = model.expectShape(inputShape.getAllMembers().values().stream().findFirst().get().getTarget());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not getAllMembers().get(0) assuming it's a collection?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAllMembers() is a map but getAllMembers().values() is a collection. However, collection does not have get method.

if (outputShape.hasTrait(UnitTypeTrait.class)) {
clientResponse = "var native_error";
returnResponse = "dafny.TupleOf()";
writer.addImportFromModule("github.com/dafny-lang/DafnyRuntimeGo", "dafny");
inputType = maybeInputType;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Why inputType is being assigned on a conditional on outputType?

Comment on lines 37 to 40
// if (shape.isResourceShape()) {
// // TypesNamespace for resources are in ShapeName
// return shape.getId().getName();
// }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the commented code.

rishav-karanjit and others added 21 commits August 22, 2024 11:57
* fix: bump Rust version to 1.80
…atically (smithy-lang#554)

As is the case for many suites of GitHub actions, it's a huge pain to manually maintain the list of required checks in the branch protection. This change leverages https://github.com/re-actors/alls-green to add a single capstone action that only passes if all dependent jobs pass (see repo README for details on why the naive approach doesn't work).

Once this is approved I'll update the required checks before merging.

Also adding Python tests to the list of triggers in the nightly build since I noticed it was missing.
This reverts commit 61d7284, reversing
changes made to 0a707a2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants