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 3 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::Extensions 4 -> 5 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/types/type_param.rs:200
variant TypeArg::Variable 5 -> 6 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/types/type_param.rs:208
variant TypeArg::Extensions 4 -> 5 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/types/type_param.rs:200
variant TypeArg::Variable 5 -> 6 in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/types/type_param.rs:208

--- 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:183
variant TypeArg::Sequence, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:183

Copy link

codecov bot commented Apr 29, 2025

Codecov Report

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

Project coverage is 83.05%. Comparing base (0b091e2) to head (6f7f52d).

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 86.11% 5 Missing ⚠️
hugr-core/src/extension/resolution/types_mut.rs 0.00% 4 Missing ⚠️
hugr-py/src/hugr/tys.py 75.00% 4 Missing ⚠️
hugr-core/src/extension/resolution/types.rs 80.00% 1 Missing ⚠️
hugr-py/src/hugr/_serialization/tys.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2140      +/-   ##
==========================================
- Coverage   83.09%   83.05%   -0.04%     
==========================================
  Files         219      219              
  Lines       41918    41961      +43     
  Branches    37993    38020      +27     
==========================================
+ Hits        34830    34850      +20     
- Misses       5278     5300      +22     
- Partials     1810     1811       +1     
Flag Coverage Δ
python 85.66% <81.48%> (-0.05%) ⬇️
rust 82.78% <71.76%> (-0.04%) ⬇️

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.

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