-
Notifications
You must be signed in to change notification settings - Fork 7
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
Helper method to compare FunctionType
s without checking extension sets.
#1209
Comments
I wonder if we should just |
It's not only about In tket2 we have multiple occurrences where we don't care about the extensions used inside a definition but only about the actual types coming in an out. This is normally the case when validating rewrite operations. E.g. |
Hmmmm, in that case the thing you are comparing against really isn't a(nother) FunctionType, but a |
So you could add |
Sure, |
For a rewrite, we'd expect the replacement to have (same or fewer) requirements, right? So But might lead to all sorts of awkward questions about covariance/contravariance - what if the return type is a (higher-order) function (value), are we allowed to reduce the extension requirements of that, etc.... |
Not necessarily. The example I wrote is part of stitching chunks of a circuit back after being updated. We can do whatever we want with those chunks as long as the signatures(' rows!) match. |
If this is post-extension-inference, and you increase the delta, you'll have to update the parent/ancestors (unless they were already loose-upper-bounds that included the new delta!), which could be non-trivial (e.g. updating a FuncDefn requires recursively increasing delta of Calls). So, be warned....(a separate issue though) |
Small helper method, should be enough to close #1209.
The
PartialEq
implementation ofFunctionType
checks that theextension_reqs
of both signatures is the same, in addition to the input/output types.I find myself writing
multiple times, when I don't care about mismatching extensions.
We could add a
FunctionType::same_types(&self, other) -> bool
method or something similar for these comparisons.The text was updated successfully, but these errors were encountered: