Skip to content

Add support for returning values from defcal statements #24

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

Merged
merged 5 commits into from
Dec 5, 2022

Conversation

Swordcat
Copy link
Contributor

Added returns method to the oqpy.Program class, for adding return statements to defcal declarations.

The Program.returns statement can also be used within @subroutine decorated functions instead of the return keyword, this opens up the possibility of having branching withing such functions that can have multiple return statements.

All added code covered by tests

Closes #21

… to defcal and subroutine statements, added support for using Program.returns in subroutine decorator based on type hinting and added tests.
@CLAassistant
Copy link

CLAassistant commented Nov 28, 2022

CLA assistant check
All committers have signed the CLA.

@Swordcat
Copy link
Contributor Author

Swordcat commented Dec 2, 2022

@PhilReinhold and @jcjaskula-aws would either of you be willing / able to review this PR?

Copy link
Collaborator

@PhilReinhold PhilReinhold left a comment

Choose a reason for hiding this comment

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

Small comment, but otherwise this all looks good to me! I'll give @jcjaskula-aws some time to leave any other comments, but if not I think we can merge.

Co-authored-by: Phil Reinhold <[email protected]>
Copy link
Collaborator

@jcjaskula-aws jcjaskula-aws left a comment

Choose a reason for hiding this comment

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

Looks very interesting, wrote some small comments. Let's follow or modify the first one on naming, the others can be reported and deferred.

@PhilReinhold PhilReinhold merged commit 951c532 into openqasm:main Dec 5, 2022
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.

Add a method to return values from defcal statements
5 participants