Skip to content

Commit

Permalink
adding back test for location ir.
Browse files Browse the repository at this point in the history
  • Loading branch information
weinbe58 committed Nov 12, 2024
1 parent ce13598 commit e3eac13
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bloqade/compiler/codegen/python/emulator_ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ def visit_field_ScaledLocations(
self, node: field.ScaledLocations
) -> Dict[int, Decimal]:
target_atoms = {}
for location in node.value.keys():
if location.value >= self.n_sites or location.value < 0:
raise ValueError(
f"Location {location.value} is out of bounds for register with "
f"{self.n_sites} sites."
)

for new_index, original_index in enumerate(self.original_index):
value = node.value.get(field.Location(original_index))
Expand Down

0 comments on commit e3eac13

Please sign in to comment.