Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Validate Extensions using hierarchy, ignore input_extensions, …
…RIP inference (#1142) This is probably phase 1 of 4, later steps being * Remove `input_extensions` and `NodeType` * Make every operation require it's own extension (#388) * Infer deltas for parent nodes (#640) - this may be disruptive, and/or take some subtlety, as currently every FunctionType stores an ExtensionSet not an Option thereof * Finally, remove the feature flag So, this PR updates validation to ignore the input_extensions, and removes the inference algorithm that would set them. There were a few complications: * A lot of tests create a DFGBuilder with an *empty* delta, then put things in it that have extension requirements. The inference algorithm figures out that this is all OK if it can just put that extension-requirement on the `input_extensions` to the DFG node (root) itself. So this might be a call for `input_extensions` - they do reduce the need for #640 a bit. * We can see roughly how painful life is (without delta-inference nor input-extensions) looking at the various extra extension-deltas I've had to specify here * I think that given we are under the feature flag at the moment, we are OK to continue, however the need for #640 is now somewhat increased, so discussion there strongly encouraged, please! :) * `TailLoop` turned out not to have an extension-delta, where it clearly needs one (just as DataflowBlock and others). Also there was an implementation of `OpParent` for it, whereas in fact we needed `DataflowParent` as that would also have got us the `ValidateOp` for free. This all in 08bb5a5. * Another bug in DataflowBlock::inner_signature, and some others. ....That is to say, in some ways this validation scheme is *stricter* than what we had; there is both the slight flexibility that `input_extensions` gave us in mis-specifying deltas, and that this scheme's simplicity makes it much harder to accidentally omit cases from validation.... I've also kept `Hugr::infer_extensions` around as a no-op rather than remove it and later bring it back (in #640). Maybe we should remove it, but that would be a breaking change....OTOH I've removed `validate_with_extension_closure` and in theory we could have that (a closure containing deltas for nested DFGs) too... BREAKING CHANGE: TailLoop node and associated builder functions now require specifying an ExtensionSet; extension/validate.rs deleted; some changes to Hugrs validated/rejected when the `extension_inference` feature flag is turned on
- Loading branch information