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

refactor!: Separate Signature from FunctionType #1044

Closed
wants to merge 11 commits into from

Conversation

acl-cqc
Copy link
Contributor

@acl-cqc acl-cqc commented May 14, 2024

Goal is to solve #1094 but not even building yet!

Plan?

  • Maybe make FunctionType inputs, outputs and extension_reqs non-pub in a first PR, we should probably do that anyway
  • Can we implement PartialEq to allow comparing FunctionType's vs Signature's (likely only one way round) so that we can compile without changes the great number of tests that compare (maybe a fixed-len Signature) against a FunctionType::new(...) (that although nominally variable-length, don't actually contain any row-vars)?

@acl-cqc acl-cqc marked this pull request as draft May 14, 2024 18:50
@acl-cqc acl-cqc force-pushed the row_typevar/separate_signature branch from 20346f3 to 9f53329 Compare May 15, 2024 07:40
@acl-cqc acl-cqc force-pushed the feat/row_typevar branch from 98182e9 to 4a41f96 Compare May 15, 2024 17:01
@@ -24,7 +24,7 @@ pub trait CustomSignatureFunc: Send + Sync {
arg_values: &[TypeArg],
def: &'o OpDef,
extension_registry: &ExtensionRegistry,
) -> Result<PolyFuncType, SignatureError>;
) -> Result<PolyFuncType<true>, SignatureError>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@acl-cqc I think this should be false?

Copy link
Collaborator

@doug-q doug-q May 16, 2024

Choose a reason for hiding this comment

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

We don't substitute args into the signature in SignatureFunc::compute_signature, but I think we could? I think this would make all uses of PolyFuncType disallow row variables (excepting perhaps funcdecl).

EDIT: no, I am confuesed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For an OpDef, we allow row variables in the type scheme (i.e. any time it's polymorphic), as long as they are gone by the time we have a node Signature. We could possibly do that final substitution + (fallible-)conversion-to-Signature inside compute_signature but we'll still need a PolyFuncType somewhere even if maybe not as public as this. (We allow custom binary compute-signature functions to return a PolyFuncType<true> if they want.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry I was unclear above. Yes I eventually came to understand that row variables should be allowed here.

Base automatically changed from feat/row_typevar to main May 22, 2024 09:33
Copy link
Contributor

github-actions bot commented May 22, 2024

Hey there and thank you for opening this pull request! 👋🏼

It looks like your proposed title indicates a breaking change. If that's the case,
please make sure to include a "BREAKING CHANGE:" footer in the body of the pull request
describing the breaking change and any migration instructions.

@acl-cqc acl-cqc force-pushed the row_typevar/separate_signature branch from 4e94de4 to cac4efb Compare May 24, 2024 09:33
@acl-cqc acl-cqc force-pushed the row_typevar/separate_signature branch from cac4efb to 2b8f0ef Compare May 25, 2024 19:06
@hugrbot
Copy link
Collaborator

hugrbot commented May 25, 2024

Hey there and thank you for opening this pull request! 👋🏼

It looks like your proposed title indicates a breaking change. If that's the case,
please make sure to include a "BREAKING CHANGE:" footer in the body of the pull request
describing the breaking change and any migration instructions.

@acl-cqc
Copy link
Contributor Author

acl-cqc commented Jun 12, 2024

Closing in favour of #1138

@acl-cqc acl-cqc closed this Jun 12, 2024
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.

3 participants