Qiskit / openqasm3_parser

Parser and semantic analyzer for the OpenQASM3 language
Apache License 2.0
10 stars 11 forks source link

Check types and do casting in classical declarations #205

Closed jlapeyre closed 5 months ago

jlapeyre commented 5 months ago

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