-
Notifications
You must be signed in to change notification settings - Fork 13
feat: insert_link_hugr adds entrypoint subtree and links, with reachability
#2555
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
base: acl/link_hugr
Are you sure you want to change the base?
Conversation
Remove unused fn directive
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## acl/link_hugr #2555 +/- ##
=================================================
+ Coverage 83.61% 83.63% +0.01%
=================================================
Files 266 266
Lines 51951 52054 +103
Branches 47370 47520 +150
=================================================
+ Hits 43441 43533 +92
- Misses 6133 6140 +7
- Partials 2377 2381 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
insert_link_hugr to add entrypoint subtree AND linkinsert_link_hugr to add entrypoint subtree AND link
| /// [`OnMultiDefn::NewFunc`] of [`OnNewFunc::RaiseError`] | ||
| /// | ||
| /// [`FuncDefn`]: crate::ops::FuncDefn | ||
| /// [`on_new_names`]: NameLinkingPolicy::get_on_new_names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I should either change the links to be called `get_on_new_names` or write `on_new_names` has been set to ...
Respin of #2531, marking the node/edge enums in the new StaticGraph as `non-exhaustive` and adding Consts + LoadConstants. (Lukas originally planned to make something like this to reflect references from Terms to functions, and non-exhaustive allows extending this StaticGraph for that purpose - if we do go that way, however, I have a different plan, can describe if relevant. Rather I think non-exhaustive is just a reasonable allowance for future extension to new use-cases hopefully without damaging existing use-cases.) This is taken from #2555, i.e. which uses it (although there it is still called CallGraph in hugr-core). Naming: could be ModuleGraph ?? Other ideas welcome. I will add a test with some Consts + use of `out_edges` (tho will be supplied in #2555 !)
insert_link_hugr to add entrypoint subtree AND linkinsert_link_hugr adds entrypoint subtree and links, with reachability
4ce1890 to
46b988c
Compare
46b988c to
d0de271
Compare
ss2165
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partial review, more to come
| /// | ||
| /// # Errors | ||
| /// | ||
| /// If other's entrypoint is its module-root (recommend using [Self::link_module] instead) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this line be above # Errors ?
| /// If other's entrypoint is its module-root (recommend using [Self::link_module] instead) | ||
| /// | ||
| /// If other's entrypoint calls (perhaps transitively) the function containing said entrypoint | ||
| /// (an exception is made if the called+containing function is public and is being replaced |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove parentheses for readability
| /// | ||
| /// If other's entrypoint calls a public [`FuncDefn`] in `other` which has the same name | ||
| /// and signature as a public [`FuncDefn`] in `self` and [`on_multi_defn`] is | ||
| /// [`OnMultiDefn::NewFunc`] of [`OnNewFunc::RaiseError`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// [`OnMultiDefn::NewFunc`] of [`OnNewFunc::RaiseError`] | |
| /// [`OnMultiDefn::NewFunc`] or [`OnNewFunc::RaiseError`] |
hugr-core/src/hugr/linking.rs
Outdated
| /// [`on_new_names`]: NameLinkingPolicy::get_on_new_names | ||
| /// [`on_multi_defn`]: NameLinkingPolicy::get_on_multiple_defn | ||
| /// [`on_sig_conflict`]: NameLinkingPolicy::get_signature_conflict | ||
| #[allow(clippy::type_complexity)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a where block might let you remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite - error: equality constraints are not yet supported in where clauses rust-lang/rust#20041
Ah, but parametrizing by HugrNode type rather than HugrView type does! Done
| let reached = mb.declare("foo", endo_sig(usize_t()).into()).unwrap(); | ||
| // This would conflict signature, but is not reached: | ||
| let unreached = mb | ||
| .declare("bar", inout_sig(vec![], usize_t()).into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
| let reached = mb.declare("foo", endo_sig(usize_t()).into()).unwrap(); | |
| // This would conflict signature, but is not reached: | |
| let unreached = mb | |
| .declare("bar", inout_sig(vec![], usize_t()).into()) | |
| let reached = mb.declare("reached", endo_sig(usize_t()).into()).unwrap(); | |
| // This would conflict signature, but is not reached: | |
| let unreached = mb | |
| .declare("unreached", inout_sig(vec![], usize_t()).into()) |
Follows #2529, which is approved, but will merge both without any intervening release.
insert_link_hugrandinsert_link_viewtaking a node under which to add the entrypointinsert_link_xxxcloses #2517
Questions remain from previous PR about factory methods for NameLinkingPolicy and whether tests need to be more systematic about covering all the policy variants.