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

machinery in simple_op.rs doesn't check extension #1241

Closed
doug-q opened this issue Jun 28, 2024 · 0 comments · Fixed by #1266
Closed

machinery in simple_op.rs doesn't check extension #1241

doug-q opened this issue Jun 28, 2024 · 0 comments · Fixed by #1266
Assignees
Labels
bug Something isn't working

Comments

@doug-q
Copy link
Collaborator

doug-q commented Jun 28, 2024

I am working with two ops:

  • tket2.quantum.Measure
  • tket2.quantum.lazy.Measure

when I have a lazy.Measure op then Tk2Op::try_from(op) succeeds erroneously.

This is because the impl MakeOpDef for Tk2Op has

    fn from_def(op_def: &OpDef) -> Result<Self, hugr::extension::simple_op::OpLoadError> {
        try_from_name(op_def.name())
    }

This function should check that the extension of op_def is correct.

I am creating the issue here because I think the simple_op.rs machinery should take care of this, perhaps adding fn extension to NamedOp?

@doug-q doug-q added the bug Something isn't working label Jun 28, 2024
@ss2165 ss2165 self-assigned this Jul 3, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 8, 2024
Closes #1241 

Used to ensure `try_from_name` only succeeds when the extension is
correct

BREAKING CHANGE:
- `MakeOpDef` trait has new required `extension` method.
- `try_from_name` takes the OpDef extension and checks it
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.

2 participants