Open jlapeyre opened 7 months ago
Version 0.4.0
These methods look for either a single statement or a body. If the body is not found, it should return None. https://github.com/Qiskit/openqasm3_parser/blob/22b55cc1582f1c98180099dca1f224d0fab11fd8/crates/oq3_syntax/src/ast/generated/nodes.rs#L270-L275
None
But when constructing the ASG, the final representation of the OQ3 program, we erroneously assume that the for statement loops over a block and never over a single statement: https://github.com/Qiskit/openqasm3_parser/blob/22b55cc1582f1c98180099dca1f224d0fab11fd8/crates/oq3_semantics/src/syntax_to_semantics.rs#L245
In case there is no block, the unwrap causes a panic.
unwrap
panic
Version 0.4.0
These methods look for either a single statement or a body. If the body is not found, it should return
None
. https://github.com/Qiskit/openqasm3_parser/blob/22b55cc1582f1c98180099dca1f224d0fab11fd8/crates/oq3_syntax/src/ast/generated/nodes.rs#L270-L275But when constructing the ASG, the final representation of the OQ3 program, we erroneously assume that the for statement loops over a block and never over a single statement: https://github.com/Qiskit/openqasm3_parser/blob/22b55cc1582f1c98180099dca1f224d0fab11fd8/crates/oq3_semantics/src/syntax_to_semantics.rs#L245
In case there is no block, the
unwrap
causes apanic
.