diff --git a/graphix_qasm_parser/parser.py b/graphix_qasm_parser/parser.py index c6090f5..52ca8df 100644 --- a/graphix_qasm_parser/parser.py +++ b/graphix_qasm_parser/parser.py @@ -836,7 +836,7 @@ def visitIfStatement(self, ctx: qasm3Parser.IfStatementContext) -> None: body = conditional_block.instructions self.block = parent_block if domain: - instruction = Instruction.CONDINSTR(tuple(body), domain) + instruction = Instruction.CONDINSTR(domain, tuple(body)) parent_block.instructions.append(instruction) else: self.warnings.append("Conditional instruction with empty condition dropped.") diff --git a/pyproject.toml b/pyproject.toml index 3672d82..8fb909a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,4 +86,4 @@ reportUnknownLambdaType = "information" # reportUnknownVariableType = "information" [tool.uv.sources] -graphix = { git = "https://github.com/TeamGraphix/graphix.git" } +graphix = { git = "https://github.com/thierry-martinez/graphix.git", branch = "fix-626" } diff --git a/tests/test_parser.py b/tests/test_parser.py index afad38e..d5a5d6b 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -454,14 +454,14 @@ def test_if_statements() -> None: assert circuit.width == 3 assert circuit.instruction == [ Instruction.M(2, Axis.Z), - Instruction.CONDINSTR((Instruction.X(0),), {2}), + Instruction.CONDINSTR({2}, (Instruction.X(0),)), Instruction.M(0, Axis.Z), Instruction.CONDINSTR( + {0, 2}, ( Instruction.X(1), Instruction.Z(1), ), - {0, 2}, ), ] @@ -485,7 +485,7 @@ def test_redundant_if_statements() -> None: assert circuit.instruction == [ Instruction.M(2, Axis.Z), Instruction.M(0, Axis.Z), - Instruction.CONDINSTR((Instruction.X(1),), {0}), + Instruction.CONDINSTR({0}, (Instruction.X(1),)), ]