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

Fix: handle positional trait in resources #725

Merged

Conversation

rishav-karanjit
Copy link
Member

@rishav-karanjit rishav-karanjit commented Nov 15, 2024

Issue #, if available:

Description of changes:
Positional trait was not being handled in Referenced Resources. This PR fixes it.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@rishav-karanjit rishav-karanjit changed the base branch from Golang/dev to fix-addMissingToNativeConv November 15, 2024 21:45
@rishav-karanjit rishav-karanjit marked this pull request as ready for review November 18, 2024 17:20
@rishav-karanjit rishav-karanjit requested a review from a team as a code owner November 18, 2024 17:20
""".formatted(
fromDafnyConvMethodName,
typeAssertion,
deReferenceRequired
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we always return a value type for Positional Output? Otherwise this might fail.

Copy link
Member Author

Choose a reason for hiding this comment

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

returnResponse =
"%s(%snative_response)".formatted(
fromDafnyConvMethodNameForOutput,
deReferenceRequired ? "*" : ""
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer this style over what's done at 923.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Remove the if else and added ternary instead of it. Now its line 922

w.write(
"""
$L($L) ($L error)
""",
operationShape.getId().getName(),
input,
output
output.equals("") ? "" : output.concat(",")
Copy link
Contributor

Choose a reason for hiding this comment

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

You can also use .isEmpty() check.

@rishav-karanjit rishav-karanjit changed the title Fix positional trait in resources Fix: handle positional trait in resources Nov 29, 2024
@rishav-karanjit rishav-karanjit merged commit 32b9626 into fix-addMissingToNativeConv Nov 29, 2024
86 checks passed
@rishav-karanjit rishav-karanjit deleted the fix-resourcesPositionalTrait branch November 29, 2024 17:23
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.

2 participants