amazon-braket / amazon-braket-sdk-python

A Python SDK for interacting with quantum devices on Amazon Braket
https://aws.amazon.com/braket/
Apache License 2.0
294 stars 118 forks source link

fix: address AutoQASM variable declaration bug introduced by PR #930 #938

Closed rmshaffer closed 3 months ago

rmshaffer commented 3 months ago

Issue #, if available: See comment here: https://github.com/amazon-braket/amazon-braket-sdk-python/pull/930#discussion_r1550003912

Description of changes: Instead of deferring the variable declaration until the end, we continue to declare the variable at the time of assignment and then remove the declaration if it is no longer needed (i.e., when the variable is being used as output).

Testing done: tox passes.

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (790ede5) to head (1ad3e66).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## feature/autoqasm #938 +/- ## ================================================== Coverage 100.00% 100.00% ================================================== Files 171 170 -1 Lines 10580 10506 -74 Branches 2267 2251 -16 ================================================== - Hits 10580 10506 -74 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.