Skip to content

feat!: Split TypeArg::Sequence into tuples and lists. #2140

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

zrho
Copy link
Contributor

@zrho zrho commented Apr 29, 2025

This PR splits up TypeArg::Sequence into TypeArg::List for homogeneous sequences and TypeArg::Tuple for heterogeneous sequences. This is closer to hugr-model and avoids the ambiguous typing of TypeArg::Sequence.

BREAKING CHANGE: TypeArg::Sequence needs to be replaced with TypeArg::List or TypeArg::Tuple in downstream code.

@hugrbot
Copy link
Collaborator

hugrbot commented Apr 29, 2025

This PR contains breaking changes to the public Rust API.

cargo-semver-checks summary

--- failure enum_no_repr_variant_discriminant_changed: enum variant had its discriminant change value ---

Description:
The enum's variant had its discriminant value change. This breaks downstream code that used its value via a numeric cast like `as isize`.
      ref: https://doc.rust-lang.org/reference/items/enumerations.html#assigning-discriminant-values
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/enum_no_repr_variant_discriminant_changed.ron

Failed in:
variant TypeArg::Variable 4 -> 5 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/types/type_param.rs:196
variant TypeArg::Variable 4 -> 5 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/types/type_param.rs:196

--- failure enum_variant_missing: pub enum variant removed or renamed ---

Description:
A publicly-visible enum has at least one variant that is no longer available under its prior name. It may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/enum_variant_missing.ron

Failed in:
variant TypeArg::Sequence, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:180
variant TypeArg::Sequence, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:180

Copy link

codecov bot commented Apr 29, 2025

Codecov Report

Attention: Patch coverage is 74.56140% with 29 lines in your changes missing coverage. Please review.

Project coverage is 82.00%. Comparing base (9b3fbb4) to head (6dabb3c).

Files with missing lines Patch % Lines
hugr-core/src/export.rs 0.00% 7 Missing ⚠️
hugr-core/src/import.rs 0.00% 7 Missing ⚠️
hugr-core/src/types/type_param.rs 84.21% 6 Missing ⚠️
hugr-py/src/hugr/tys.py 75.00% 4 Missing ⚠️
hugr-core/src/extension/resolution/types.rs 66.66% 2 Missing ⚠️
hugr-core/src/extension/resolution/types_mut.rs 50.00% 1 Missing and 1 partial ⚠️
hugr-py/src/hugr/_serialization/tys.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2140      +/-   ##
==========================================
- Coverage   82.04%   82.00%   -0.05%     
==========================================
  Files         234      234              
  Lines       41704    41754      +50     
  Branches    37616    37650      +34     
==========================================
+ Hits        34216    34239      +23     
- Misses       5513     5540      +27     
  Partials     1975     1975              
Flag Coverage Δ
python 85.30% <81.48%> (-0.05%) ⬇️
rust 81.64% <72.41%> (-0.05%) ⬇️

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.

@zrho zrho force-pushed the zrho/core-sequence branch from 6f7f52d to cb825ff Compare May 21, 2025 13:41
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