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

Handle conflicts between user-defined parameter names and automatically-modified parameter names #30

Open
rmshaffer opened this issue Jun 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rmshaffer
Copy link
Contributor

rmshaffer commented Jun 12, 2024

Describe the bug
If a user labels subroutine parameters in a program as both xyz and xyz_, where xyz is some reserved word (like qubit or bit), this may lead to unexpected behavior, as the xyz gets automatically renamed to xyz_ during the transpilation process.

See this comment thread for more details: https://github.com/amazon-braket/autoqasm/pull/28/files#r1635398668

To reproduce
Create an aq.subroutine with parameters named qubit and qubit_. Note that AutoQASM tries to generate a subroutine with two parameters named qubit_, which causes an error.

Expected behavior
If the Python variable names are different, then we should ensure that the resulting OpenQASM variable names do not conflict.

We could also potentially add a comment (using /* */) in the generated OpenQASM when a variable name is modified, to be super clear to the user about how we have changed the program.

@rmshaffer rmshaffer added the bug Something isn't working label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant