Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Python struct syntax incorrectly documented #2364

Open
1 task done
bebora opened this issue Nov 7, 2024 · 0 comments · May be fixed by #2365
Open
1 task done

[docs] Python struct syntax incorrectly documented #2364

bebora opened this issue Nov 7, 2024 · 0 comments · May be fixed by #2365
Labels
enhancement New feature or request

Comments

@bebora
Copy link

bebora commented Nov 7, 2024

Required prerequisites

  • Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.

Describe the feature

The Quantum Kernel documentation lists allowed types. An example struct is there defined as follows:

class MySimpleStruct(object):
    def __init__(self):
        self.i = 0
        self.j = 0

Using a custom class as the one above and accessing its elements in a quantum kernel produces the following error:
cudaq.kernel.ast_bridge.CompilerError: struct_example.py:14: error: Invalid struct member: MySimpleStruct.i (members=[])
Since #1939, data structs can be defined as follows:

@dataclass
class MySimpleStruct:
    i : int
    j : int

The documentation should be updated accordingly.

@bebora bebora added the enhancement New feature or request label Nov 7, 2024
@bebora bebora linked a pull request Nov 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant