Skip to content

fix: ReplaceTypes: operate on whole Hugr, with set_regions#2662

Merged
acl-cqc merged 2 commits intomainfrom
acl/replace_types_global
Nov 3, 2025
Merged

fix: ReplaceTypes: operate on whole Hugr, with set_regions#2662
acl-cqc merged 2 commits intomainfrom
acl/replace_types_global

Conversation

@acl-cqc
Copy link
Copy Markdown
Contributor

@acl-cqc acl-cqc commented Nov 3, 2025

Behaviour fix after #2633, includes reverting test changes there.

Behaviour of ReplaceTypes was never documented, but operating only beneath the entrypoint is clearly obstructive, so default to the whole Hugr.

@acl-cqc acl-cqc requested a review from ss2165 November 3, 2025 13:15
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.41%. Comparing base (3fbab06) to head (b36a2e2).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2662      +/-   ##
==========================================
+ Coverage   83.40%   83.41%   +0.01%     
==========================================
  Files         262      262              
  Lines       51135    51176      +41     
  Branches    46696    46737      +41     
==========================================
+ Hits        42648    42689      +41     
  Misses       6109     6109              
  Partials     2378     2378              
Flag Coverage Δ
python 91.46% <ø> (ø)
rust 82.65% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

///
/// If not set, the pass is applied to the whole Hugr.
/// Each call to overwrites any previous calls to `set_regions`.
pub fn set_regions(&mut self, regions: impl IntoIterator<Item = Node>) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

chaining with_regions might be better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OIC - as in with_regions(mut self, regions....) -> Self. Yeah, but this is more consistent with the other config methods.

Thought you meant the behaviour where multiple calls override rather than accumulate....accumulation leads to the first call being special, i.e. replacing the default of "the module root"

@acl-cqc acl-cqc marked this pull request as ready for review November 3, 2025 14:30
@acl-cqc acl-cqc requested a review from a team as a code owner November 3, 2025 14:30
@acl-cqc acl-cqc requested review from croyzor and ss2165 and removed request for croyzor November 3, 2025 14:30
@ss2165 ss2165 self-requested a review November 3, 2025 14:30
@acl-cqc acl-cqc added this pull request to the merge queue Nov 3, 2025
Merged via the queue into main with commit c0c42ee Nov 3, 2025
32 checks passed
@acl-cqc acl-cqc deleted the acl/replace_types_global branch November 3, 2025 14:42
@hugrbot hugrbot mentioned this pull request Nov 3, 2025
github-merge-queue bot pushed a commit that referenced this pull request Nov 4, 2025
## 🤖 New release

* `hugr-model`: 0.24.1 -> 0.24.2
* `hugr-core`: 0.24.1 -> 0.24.2
* `hugr-llvm`: 0.24.1 -> 0.24.2
* `hugr-passes`: 0.24.1 -> 0.24.2 (✓ API compatible changes)
* `hugr`: 0.24.1 -> 0.24.2 (✓ API compatible changes)
* `hugr-cli`: 0.24.1 -> 0.24.2 (✓ API compatible changes)
* `hugr-persistent`: 0.3.2 -> 0.3.3

<details><summary><i><b>Changelog</b></i></summary><p>

## `hugr-model`

<blockquote>

##
[0.24.1](hugr-model-v0.24.0...hugr-model-v0.24.1)
- 2025-11-03

### Bug Fixes

- Correct conversion of `table::Term::Tuple` to `ast::Term`
([#2653](#2653))
</blockquote>

## `hugr-core`

<blockquote>

##
[0.24.1](hugr-core-v0.24.0...hugr-core-v0.24.1)
- 2025-11-03

### Bug Fixes

- validation outside entrypoint, normalize_cfgs w/ nonlocal edges
([#2633](#2633))
- SiblingSubgraph::try_from_nodes for non-entrypoint region
([#2655](#2655))
- Correct conversion of `table::Term::Tuple` to `ast::Term`
([#2653](#2653))

### New Features

- track package descriptions when loading
([#2639](#2639))
- *(cli)* describe sub-command
([#2650](#2650))
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.24.0](hugr-llvm-v0.23.0...hugr-llvm-v0.24.0)
- 2025-10-13

### New Features

- LLVM lowering for borrow arrays using bitmasks
([#2574](#2574))
- *(py, core, llvm)* add `is_borrowed` op for BorrowArray
([#2610](#2610))

### Refactor

- [**breaking**] consistent inout order in borrow array
([#2621](#2621))
</blockquote>

## `hugr-passes`

<blockquote>

##
[0.24.2](hugr-passes-v0.24.1...hugr-passes-v0.24.2)
- 2025-11-03

### Bug Fixes

- ReplaceTypes: operate on whole Hugr, with set_regions
([#2662](#2662))
</blockquote>

## `hugr`

<blockquote>

##
[0.24.2](hugr-v0.24.1...hugr-v0.24.2)
- 2025-11-03

### Bug Fixes

- ReplaceTypes: operate on whole Hugr, with set_regions
([#2662](#2662))
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.24.1](hugr-cli-v0.24.0...hugr-cli-v0.24.1)
- 2025-11-03

### New Features

- track package descriptions when loading
([#2639](#2639))
- *(cli)* describe sub-command
([#2650](#2650))
</blockquote>

## `hugr-persistent`

<blockquote>

##
[0.3.2](hugr-persistent-v0.3.1...hugr-persistent-v0.3.2)
- 2025-11-03

### New Features

- *(persistent)* More efficient HugrView iterators for PersistentHugr
([#2595](#2595))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
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.

2 participants