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

Change compute_signature to return FunctionType (et al) #438

Merged
merged 3 commits into from
Aug 29, 2023

Conversation

acl-cqc
Copy link
Contributor

@acl-cqc acl-cqc commented Aug 22, 2023

....as this is now equal to the current tuple (TypeRow,TypeRow,Extensions). A longstanding TODO.

Note this does not address the confusion/disagreement across the codebase as to whether the ExtensionSet should include the resource declaring the op.

@acl-cqc acl-cqc requested a review from ss2165 August 22, 2023 12:53
@@ -227,7 +227,7 @@ impl OpDef {
// TODO bring this assert back once resource inference is done?
// https://github.com/CQCL-DEV/hugr/issues/425
// assert!(res.contains(self.extension()));
Ok(FunctionType::new(ins, outs).with_extension_delta(&res))
Ok(res)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left this as this slightly-long-way around because of the preceding comment, which I've not tried to address in this PR. (Perhaps I could, but it's orthogonal, and looks like it might be opening another can of worms - it relates to #389 so I've noted it on there.)

Copy link
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but alternatively one could use FunctionType::new(..., ...).with_extension_delta(...)

I think that is much preferable - makes the extension definitions more readable.

@acl-cqc
Copy link
Contributor Author

acl-cqc commented Aug 22, 2023

I think that is much preferable - makes the extension definitions more readable.

Heh, I came to the same (or nearly) conclusion independently, and have switched to FunctionType::new in cases where the ExtensionSet is empty (new/default) - the vast majority.

There does still appear to be some confusion/disagreement in the code as to whether the ExtensionSet should include the owning Resource, but let's leave that for #389 .

@acl-cqc acl-cqc requested a review from ss2165 August 22, 2023 19:17
Copy link
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@acl-cqc acl-cqc enabled auto-merge August 29, 2023 08:19
@acl-cqc acl-cqc added this pull request to the merge queue Aug 29, 2023
Merged via the queue into main with commit a323545 Aug 29, 2023
6 checks passed
@acl-cqc acl-cqc deleted the refactor/compute_function_type branch August 29, 2023 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants