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

Improve error message for mistake in module compilation #779

Open
CalMacCQ opened this issue Jan 22, 2025 · 0 comments
Open

Improve error message for mistake in module compilation #779

CalMacCQ opened this issue Jan 22, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@CalMacCQ
Copy link
Contributor

CalMacCQ commented Jan 22, 2025

The code snippet below is incorrect. The mistake is that in the last line we need to do module1.compile() rather than guppy.compile_module().

from guppylang import guppy, GuppyModule
from guppylang.std.quantum import qubit, h

module1 = GuppyModule(name="module1")
module1.load(qubit, h)

@guppy(module1)
def generate_plus() -> qubit:
    q = qubit()
    return h(q)

guppy.compile_module()

From the error message its not clear how to correct this

---------------------------------------------------------------------------
GuppyError                                Traceback (most recent call last)


.........

GuppyError: VarNotDefinedError(span=<ast.Name object at 0x114beab90>, _parent=None, children=[], var='qubit')
@CalMacCQ CalMacCQ added the enhancement New feature or request label Jan 22, 2025
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

No branches or pull requests

1 participant