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

Linearity checking bug #438

Closed
mark-koch opened this issue Sep 2, 2024 · 0 comments · Fixed by #441
Closed

Linearity checking bug #438

mark-koch opened this issue Sep 2, 2024 · 0 comments · Fixed by #441
Assignees
Labels
bug Something isn't working

Comments

@mark-koch
Copy link
Collaborator

mark-koch commented Sep 2, 2024

The following program incorrectly fails linearity checking:

@guppy.struct(module)
class MyStruct:
    q: qubit


@guppy.declare(module)
def use(q: qubit) -> None: ...


@guppy(module)
def test(s: MyStruct) -> MyStruct:
    use(s.q)
    while True:
        s.q = qubit()
        return s
    # Guppy is not yet smart enough to detect that this code is unreachable
    s.q = qubit()
    return s
@mark-koch mark-koch added the bug Something isn't working label Sep 2, 2024
@mark-koch mark-koch self-assigned this Sep 2, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 2, 2024
Fixes #438.

When checking that all live linear places in scope are definitely used,
we have to be more careful about determining whether variables are
*actually* live rather than only being included in scope because of the
less precise first pass of liveness analysis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant