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

Type checking and casting in classical declaration statements #203

Closed
jlapeyre opened this issue Mar 27, 2024 · 0 comments · Fixed by #205
Closed

Type checking and casting in classical declaration statements #203

jlapeyre opened this issue Mar 27, 2024 · 0 comments · Fixed by #205
Labels
required feature Feature or behavior in OQ3 spec, needs implementation

Comments

@jlapeyre
Copy link
Collaborator

jlapeyre commented Mar 27, 2024

This is not implemented (well not correctly. But the existing check is bad enough that I would call it just unimplemented)

For example, the following parses to ASG without error:

qubit q;
float x = q;

And if types are compatible with implicit casting, the Cast operation should be added, but it is not.

@jlapeyre jlapeyre added the required feature Feature or behavior in OQ3 spec, needs implementation label Mar 27, 2024
jlapeyre added a commit to jlapeyre/openqasm3_parser that referenced this issue Mar 28, 2024
Implement checking compatibility of types of lhs and rhs in classical
assignment statement. If an implicit cast is needed, add an explicit
cast.

Prior to this commit there was essentially nothing in place to do
these things (just a very small amount, and broken at that). This is
certainly not the end of the story. There will be edge cases. But this
is a good start which should capture many common scenarios.

Since we are developing quickly and writing tests for this ASG is
very tedious and verbose, we have not been testing very carefully.
However, the kind of thing done in this commit is inherently fragile,
so we need to begin with more testing.

Closes Qiskit#203
jlapeyre added a commit to jlapeyre/openqasm3_parser that referenced this issue Mar 28, 2024
Implement checking compatibility of types of lhs and rhs in classical
assignment statement. If an implicit cast is needed, add an explicit
cast.

Prior to this commit there was essentially nothing in place to do
these things (just a very small amount, and broken at that). This is
certainly not the end of the story. There will be edge cases. But this
is a good start which should capture many common scenarios.

Since we are developing quickly and writing tests for this ASG is
very tedious and verbose, we have not been testing very carefully.
However, the kind of thing done in this commit is inherently fragile,
so we need to begin with more testing.

Closes Qiskit#203
jlapeyre added a commit that referenced this issue Mar 28, 2024
Implement checking compatibility of types of lhs and rhs in classical
assignment statement. If an implicit cast is needed, add an explicit
cast.

Prior to this commit there was essentially nothing in place to do
these things (just a very small amount, and broken at that). This is
certainly not the end of the story. There will be edge cases. But this
is a good start which should capture many common scenarios.

Since we are developing quickly and writing tests for this ASG is
very tedious and verbose, we have not been testing very carefully.
However, the kind of thing done in this commit is inherently fragile,
so we need to begin with more testing.

Closes #203
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
required feature Feature or behavior in OQ3 spec, needs implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant