Skip to content

fix: Panic on constant folding with opaque consts#2986

Merged
aborgna-q merged 4 commits intomainfrom
ab/fix-constfold-float
Mar 26, 2026
Merged

fix: Panic on constant folding with opaque consts#2986
aborgna-q merged 4 commits intomainfrom
ab/fix-constfold-float

Conversation

@aborgna-q
Copy link
Copy Markdown
Collaborator

@aborgna-q aborgna-q commented Mar 26, 2026

Fixes Quantinuum/tket2#1473, fixes Quantinuum/tket2#1475 by replacing an expect with returning None instead.

Fixes and adds regression tests for

  • FloatOps
  • ListOp
  • ConvertOpDef

@aborgna-q aborgna-q requested a review from a team as a code owner March 26, 2026 11:06
@aborgna-q aborgna-q requested a review from doug-q March 26, 2026 11:06
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.28%. Comparing base (8d8d04e) to head (e1e2ac9).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...e/src/std_extensions/collections/list/list_fold.rs 66.66% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2986      +/-   ##
==========================================
+ Coverage   81.14%   81.28%   +0.14%     
==========================================
  Files         239      239              
  Lines       45315    45338      +23     
  Branches    39131    39154      +23     
==========================================
+ Hits        36770    36855      +85     
+ Misses       6562     6492      -70     
- Partials     1983     1991       +8     
Flag Coverage Δ
python 88.90% <ø> (ø)
rust 80.08% <92.68%> (+0.17%) ⬆️

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.

@aborgna-q aborgna-q changed the title fix: Panic on constant folding floats with opaque consts fix: Panic on constant folding with opaque consts Mar 26, 2026
@aborgna-q aborgna-q requested review from croyzor and removed request for doug-q March 26, 2026 12:02
@aborgna-q aborgna-q added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 4c7257e Mar 26, 2026
32 checks passed
@aborgna-q aborgna-q deleted the ab/fix-constfold-float branch March 26, 2026 13:13
@hugrbot hugrbot mentioned this pull request Mar 26, 2026
github-merge-queue bot pushed a commit to Quantinuum/tket2 that referenced this pull request Mar 26, 2026
@hugrbot hugrbot mentioned this pull request Mar 31, 2026
github-merge-queue bot pushed a commit that referenced this pull request Mar 31, 2026
## 🤖 New release

* `hugr-model`: 0.26.1 -> 0.27.0 (✓ API compatible changes)
* `hugr-core`: 0.26.1 -> 0.27.0 (✓ API compatible changes)
* `hugr-llvm`: 0.26.1 -> 0.27.0 (✓ API compatible changes)
* `hugr-persistent`: 0.5.1 -> 0.6.0 (✓ API compatible changes)
* `hugr`: 0.26.1 -> 0.27.0 (✓ API compatible changes)
* `hugr-cli`: 0.26.1 -> 0.27.0 (✓ API compatible changes)

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

## `hugr-model`

<blockquote>

##
[0.26.0](hugr-model-v0.25.7...hugr-model-v0.26.0)
- 2026-03-16

### Testing

- Replace model text snapshots with roundtrip tests
([#2933](#2933))
- Add missing width arg in model-call example
([#2945](#2945))
</blockquote>

## `hugr-core`

<blockquote>

##
[0.27.0](hugr-core-v0.26.1...hugr-core-v0.27.0)
- 2026-03-31

### Bug Fixes

- Use valid identifiers when constructing AST model
([#2973](#2973))
- Panic on constant folding with opaque consts
([#2986](#2986))

### New Features

- *(py)* Allow missing ext versions ExtensionDesc metadata
([#2979](#2979))
- [**breaking**] Deprecate JSON serialization format
([#2991](#2991))
- [**breaking**] Bump public `portgraph` dependency to `0.16.0`
([#2998](#2998))

### Refactor

- Simplify validate_subtree
([#2969](#2969))
- further cleanups to SiblingSubgraph + generalize over trait
HugrConvexChecker
([#2957](#2957))
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.27.0](hugr-llvm-v0.26.1...hugr-llvm-v0.27.0)
- 2026-03-31

### New Features

- *(hugr-llvm)* Emit rounding operation for `FloatOps::fround` extension
ops ([#2949](#2949))
</blockquote>

## `hugr-persistent`

<blockquote>

##
[0.6.0](hugr-persistent-v0.5.1...hugr-persistent-v0.6.0)
- 2026-03-31

### New Features

- [**breaking**] Deprecate JSON serialization format
([#2991](#2991))
</blockquote>

## `hugr`

<blockquote>

##
[0.27.0](hugr-v0.26.1...hugr-v0.27.0)
- 2026-03-31

### Bug Fixes

- Use valid identifiers when constructing AST model
([#2973](#2973))
- Panic on constant folding with opaque consts
([#2986](#2986))

### New Features

- *(py)* Allow missing ext versions ExtensionDesc metadata
([#2979](#2979))
- [**breaking**] Bump public `portgraph` dependency to `0.16.0`
([#2998](#2998))
- [**breaking**] Deprecate JSON serialization format
([#2991](#2991))

### Refactor

- Simplify validate_subtree
([#2969](#2969))
- further cleanups to SiblingSubgraph + generalize over trait
HugrConvexChecker
([#2957](#2957))
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.27.0](hugr-cli-v0.26.1...hugr-cli-v0.27.0)
- 2026-03-31

### Bug Fixes

- Do extension resolution on exts loaded by hugr-cli
([#2987](#2987))

### New Features

- *(py)* Allow missing ext versions ExtensionDesc metadata
([#2979](#2979))
- [**breaking**] Deprecate JSON serialization format
([#2991](#2991))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: Agustín Borgna <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants