Skip to content

Commit

Permalink
Fix issue with unknown base on attribute call (throw an error)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
  • Loading branch information
amccaskey committed Apr 11, 2024
1 parent edac569 commit 45177a6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/cudaq/kernel/ast_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,10 @@ def bodyBuilder(iterVal):
# Method call on one of our variables
var = self.symbolTable[node.func.value.id]
if quake.VeqType.isinstance(var.type):
if node.func.attr == 'size':
# Handled already in the Attribute visit
return

# `qreg` or `qview` method call
if node.func.attr == 'back':
qrSize = quake.VeqSizeOp(self.getIntegerType(),
Expand Down Expand Up @@ -1804,6 +1808,9 @@ def bodyBuilder(iterVal):
f'Unknown attribute on quantum operation {node.func.value.id} ({node.func.attr}). {maybeProposeOpAttrFix(node.func.value.id, node.func.attr)}'
)

self.emitFatalError(f"Invalid function call - '{node.func.value.id}' is unknown.")


def visit_ListComp(self, node):
"""
This method currently supports lowering simple list comprehensions
Expand Down

0 comments on commit 45177a6

Please sign in to comment.