fix: ModifierResolverPass preserve non-local edges with classical DAG#1792
fix: ModifierResolverPass preserve non-local edges with classical DAG#1792nicolaassolini-qntm wants to merge 16 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1792 +/- ##
==========================================
+ Coverage 85.74% 85.77% +0.02%
==========================================
Files 198 198
Lines 31478 31527 +49
Branches 30033 30082 +49
==========================================
+ Hits 26991 27041 +50
Misses 3208 3208
+ Partials 1279 1278 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes an invalid HUGR generation case in ModifierResolverPass by ensuring that when a classical DFG (or other sub-container) is copied wholesale, any non-local static function-call edges into that copied subtree are preserved via the resolver’s call-map reconnection mechanism.
Changes:
- Enhance
copy_sub_container_no_modificationto detect and preserve non-localEdgeKind::Functioninputs by recording them intocall_mapwhen copying a subtree. - Add a new Rust regression test case intended to cover external function-call edges within a DFG context under modifiers.
- Extend the
classical_function.pymodifier example to include a higher-order classical call inside a modified context (dagger + control).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tket/src/modifier/modifier_resolver/dfg_modify.rs | Preserves non-local static function-call edges when copying an unmodified subtree; adds a regression test case. |
| test_files/modifier_examples/classical_function.py | Adds a higher-order classical call inside a modified context to exercise the reported scenario. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
closes #1789
When a DFG classical block is found, the DFG is copied as it is. When the DFG contained a non-local edge (a function call), an invalid hugr was generated since the edge was not copied.