-
Notifications
You must be signed in to change notification settings - Fork 312
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
visitIODeclaration does not support arrayType #474
Comments
how did openqasm apply for angle type? |
I believe it is handled as one of the scalar types if you look at the parser.py file line 743: |
angle type represent of phase of quantum state but scalar type represent amplituted of quantum state, i have a confussion about role of angle type if this is handled as scalar type |
OpenQASM version:
3.0 (0.4.0)
Python version:
3.11
Operating system:
macOS 13.0 (Ventura)
What is the current behavior?
Parsing a OpenQASM string with arrayType inputs raises an error.
Steps to reproduce the problem
Create a new Conda environment
raises error when processing the last line, in openqasm3/parser.py in visitIODeclarationStatement line
type=self.visit(ctx.scalarType())
What is the expected behavior?
OpenQASM grammar definition shows support for arrayTypes https://github.com/openqasm/openqasm/blob/main/source/grammar/qasm3Parser.g4#L96 but visitIODeclaration only visits scalarType() as mentioned above.
This differs from visitClassicalDeclarationStatement where type does include arrayTypes():
type=self.visit(ctx.scalarType() or ctx.arrayType())
Suggested solutions (Optional)
Adding
or ctx.arrayType()
to the visit call in visitIODeclarationStatement, similar to the statement in visitClassicalDeclarationStatementThe text was updated successfully, but these errors were encountered: