-
Notifications
You must be signed in to change notification settings - Fork 14
fix: Make SumType::Unit(N) equal to SumType::General([(); N]) #2250
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2250 +/- ##
=======================================
Coverage 81.99% 82.00%
=======================================
Files 237 237
Lines 42767 42782 +15
Branches 38679 38694 +15
=======================================
+ Hits 35068 35084 +16
+ Misses 5706 5705 -1
Partials 1993 1993
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:
|
ss2165
approved these changes
May 23, 2025
This was referenced May 23, 2025
Closed
Closed
Merged
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 3, 2025
## 🤖 New release * `hugr-model`: 0.20.0 -> 0.20.1 * `hugr-core`: 0.20.0 -> 0.20.1 (✓ API compatible changes) * `hugr-llvm`: 0.20.0 -> 0.20.1 (✓ API compatible changes) * `hugr-passes`: 0.20.0 -> 0.20.1 (✓ API compatible changes) * `hugr`: 0.20.0 -> 0.20.1 (✓ API compatible changes) * `hugr-cli`: 0.20.0 -> 0.20.1 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr-model` <blockquote> ## [0.20.0](hugr-model-v0.19.0...hugr-model-v0.20.0) - 2025-05-14 ### New Features - [**breaking**] Mark all Error enums as non_exhaustive ([#2056](#2056)) - [**breaking**] Bump MSRV to 1.85 ([#2136](#2136)) - Export and import entrypoints via metadata in `hugr-model`. ([#2172](#2172)) - Define text-model envelope formats ([#2188](#2188)) - Import CFG regions without adding an entry block. ([#2200](#2200)) - Symbol applications can leave out prefixes of wildcards. ([#2201](#2201)) </blockquote> ## `hugr-core` <blockquote> ## [0.20.1](hugr-core-v0.20.0...hugr-core-v0.20.1) - 2025-06-03 ### Bug Fixes - check well-definedness of DFG wires in validate ([#2221](#2221)) - Check for order edges in SiblingSubgraph::from_node ([#2223](#2223)) - Make SumType::Unit(N) equal to SumType::General([(); N]) ([#2250](#2250)) - canonicalize_nodes sometimes mangles the entrypoint ([#2263](#2263)) ### New Features - Add PersistentHugr ([#2080](#2080)) - Add `Type::used_extensions` ([#2224](#2224)) - Add boundary edge traversal in SimpleReplacement ([#2231](#2231)) - Add signature map function for DFGs ([#2239](#2239)) - PersistentHugr implements HugrView ([#2202](#2202)) - PersistentHugr Walker API ([#2168](#2168)) - Hugr::store_with_exts and auto-include in serde_as ([#2280](#2280)) ### Refactor - tidies/readability improvements to PersistentHugr ([#2251](#2251)) - Deprecate ValidationError::ExtensionError ([#2281](#2281)) ### Testing - Ignore miri errors in tests involving `assert_snapshot` ([#2261](#2261)) </blockquote> ## `hugr-llvm` <blockquote> ## [0.20.1](hugr-llvm-v0.20.0...hugr-llvm-v0.20.1) - 2025-06-03 ### Bug Fixes - Make SumType::Unit(N) equal to SumType::General([(); N]) ([#2250](#2250)) ### Testing - Add exec tests for widen op ([#2043](#2043)) </blockquote> ## `hugr-passes` <blockquote> ## [0.20.1](hugr-passes-v0.20.0...hugr-passes-v0.20.1) - 2025-06-03 ### Bug Fixes - Dataflow analysis produces unsound results on Hugrs with entrypoint ([#2255](#2255)) ### New Features - LocalizeEdges pass ([#2237](#2237)) </blockquote> ## `hugr` <blockquote> ## [0.20.1](hugr-v0.20.0...hugr-v0.20.1) - 2025-06-03 ### Bug Fixes - Dataflow analysis produces unsound results on Hugrs with entrypoint ([#2255](#2255)) - check well-definedness of DFG wires in validate ([#2221](#2221)) - Check for order edges in SiblingSubgraph::from_node ([#2223](#2223)) - Make SumType::Unit(N) equal to SumType::General([(); N]) ([#2250](#2250)) - canonicalize_nodes sometimes mangles the entrypoint ([#2263](#2263)) ### New Features - LocalizeEdges pass ([#2237](#2237)) - Add PersistentHugr ([#2080](#2080)) - Add `Type::used_extensions` ([#2224](#2224)) - Add boundary edge traversal in SimpleReplacement ([#2231](#2231)) - Add signature map function for DFGs ([#2239](#2239)) - PersistentHugr implements HugrView ([#2202](#2202)) - PersistentHugr Walker API ([#2168](#2168)) - Hugr::store_with_exts and auto-include in serde_as ([#2280](#2280)) ### Refactor - tidies/readability improvements to PersistentHugr ([#2251](#2251)) - Deprecate ValidationError::ExtensionError ([#2281](#2281)) ### Testing - Ignore miri errors in tests involving `assert_snapshot` ([#2261](#2261)) </blockquote> ## `hugr-cli` <blockquote> ## [0.20.1](hugr-cli-v0.20.0...hugr-cli-v0.20.1) - 2025-06-03 ### New Features - support external subcommands via PATH ([#1343](#1343)) ([#2278](#2278)) </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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SumType
can represent the same sum of empty tuples in two different ways, but its equality implementation didn't consider them equal.This PR fixes this by manually implementing
PartialEq
, as well asHash
(to preserve correctness).We already do that on the python side
hugr/hugr-py/src/hugr/tys.py
Lines 311 to 312 in 940895c
Ideally we'd make the general-sum-of-empty-tuples unrepresentable, but since
SumType
is an enum (with public member), we are not able to avoid arbitrary mutation.