Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion graphix_qasm_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
6 changes: 3 additions & 3 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
),
]

Expand All @@ -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),)),
]


Expand Down
Loading