Skip to content

refactor(hugrv2)!: Rename Terms to clarify (runtime) Types from static parameter Kinds#3019

Draft
acl-cqc wants to merge 6 commits intoacl/type_wraps_termfrom
acl/rename_type_kind
Draft

refactor(hugrv2)!: Rename Terms to clarify (runtime) Types from static parameter Kinds#3019
acl-cqc wants to merge 6 commits intoacl/type_wraps_termfrom
acl/rename_type_kind

Conversation

@acl-cqc
Copy link
Copy Markdown
Contributor

@acl-cqc acl-cqc commented Apr 7, 2026

Follows #2895. (TODO needs rebasing to come after #3022 as well tho I don't think they conflict)

Using Type to mean a static parameter (that accepts a static Term argument) is confusing; instead keep Type as meaning a type of runtime values

  • Term::RuntimeType becomes Term::TypeKind
  • Term::XXXType becomes Term:::XXXKind (e.g. StringType -> StringKind, ListType -> ListKind)
  • Term::RuntimeXXX becomes Term::XXXType (e.g. Term::RuntimeExtension -> Term::ExtensionType)
  • check_term_type -> check_term_kind

Question Should we also change TermTypeError::TypeMismatch { term, type_} to TermTypeError::KindMismatch {value, kind}? I guess we should??

BREAKING CHANGE: many renames of variants of Term; ...Types are now Kinds, Runtime... are now Types. Also check_term_type is now check_term_kind

@acl-cqc acl-cqc changed the title Acl/rename type kind refactor(hugrv2)!: Rename Terms to distinguish (runtime) Types from static parameter Kinds Apr 7, 2026
@acl-cqc acl-cqc changed the title refactor(hugrv2)!: Rename Terms to distinguish (runtime) Types from static parameter Kinds refactor(hugrv2)!: Rename Terms to clarify (runtime) Types from static parameter Kinds Apr 7, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 69.72973% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.27%. Comparing base (2697658) to head (0561c05).

Files with missing lines Patch % Lines
hugr-core/src/types/type_param.rs 65.42% 37 Missing ⚠️
hugr-core/src/types/serialize.rs 84.00% 4 Missing ⚠️
hugr-core/src/extension/op_def.rs 0.00% 0 Missing and 3 partials ⚠️
hugr-core/src/extension/resolution/types.rs 57.14% 3 Missing ⚠️
hugr-core/src/extension/resolution/types_mut.rs 57.14% 3 Missing ⚠️
hugr-core/src/export.rs 83.33% 2 Missing ⚠️
hugr-core/src/import.rs 66.66% 1 Missing and 1 partial ⚠️
hugr-core/src/extension/type_def.rs 75.00% 1 Missing ⚠️
hugr-core/src/types.rs 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           acl/type_wraps_term    #3019      +/-   ##
=======================================================
- Coverage                81.30%   81.27%   -0.04%     
=======================================================
  Files                      239      239              
  Lines                    45290    45215      -75     
  Branches                 39058    38983      -75     
=======================================================
- Hits                     36824    36748      -76     
- Misses                    6466     6468       +2     
+ Partials                  2000     1999       -1     
Flag Coverage Δ
python 88.89% <ø> (ø)

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.

@hugrbot
Copy link
Copy Markdown
Collaborator

hugrbot commented Apr 7, 2026

This PR contains breaking changes to the public Rust API.

cargo-semver-checks summary
    Building hugr v0.27.0 (current)
     Built [  34.472s] (current)
   Parsing hugr v0.27.0 (current)
    Parsed [   0.004s] (current)
  Building hugr v0.27.0 (baseline)
     Built [  33.967s] (baseline)
   Parsing hugr v0.27.0 (baseline)
    Parsed [   0.004s] (baseline)
  Checking hugr v0.27.0 -> v0.27.0 (assume minor change)
   Checked [   0.011s] 196 checks: 196 pass, 56 skip
   Summary no semver update required
  Finished [  69.896s] hugr
  Building hugr-cli v0.27.0 (current)
     Built [  28.672s] (current)
   Parsing hugr-cli v0.27.0 (current)
    Parsed [   0.006s] (current)
  Building hugr-cli v0.27.0 (baseline)
     Built [  28.535s] (baseline)
   Parsing hugr-cli v0.27.0 (baseline)
    Parsed [   0.006s] (baseline)
  Checking hugr-cli v0.27.0 -> v0.27.0 (assume minor change)
   Checked [   0.015s] 196 checks: 196 pass, 56 skip
   Summary no semver update required
  Finished [  58.401s] hugr-cli
  Building hugr-core v0.27.0 (current)
     Built [  24.329s] (current)
   Parsing hugr-core v0.27.0 (current)
    Parsed [   0.082s] (current)
  Building hugr-core v0.27.0 (baseline)
     Built [  24.580s] (baseline)
   Parsing hugr-core v0.27.0 (baseline)
    Parsed [   0.075s] (baseline)
  Checking hugr-core v0.27.0 -> v0.27.0 (assume minor change)
   Checked [   0.212s] 196 checks: 194 pass, 2 fail, 0 warn, 56 skip

--- 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.47.0/src/lints/enum_variant_missing.ron

Failed in:
variant Term::RuntimeType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:87
variant Term::StaticType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:89
variant Term::BoundedNatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:95
variant Term::StringType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:97
variant Term::BytesType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:99
variant Term::FloatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:101
variant Term::ListType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:105
variant Term::TupleType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:108
variant Term::RuntimeExtension, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:114
variant Term::RuntimeFunction, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:120
variant Term::RuntimeSum, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:124
variant Term::ConstType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:177
variant Term::RuntimeType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:87
variant Term::StaticType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:89
variant Term::BoundedNatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:95
variant Term::StringType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:97
variant Term::BytesType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:99
variant Term::FloatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:101
variant Term::ListType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:105
variant Term::TupleType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:108
variant Term::RuntimeExtension, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:114
variant Term::RuntimeFunction, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:120
variant Term::RuntimeSum, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:124
variant Term::ConstType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:177
variant Term::RuntimeType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:87
variant Term::StaticType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:89
variant Term::BoundedNatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:95
variant Term::StringType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:97
variant Term::BytesType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:99
variant Term::FloatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:101
variant Term::ListType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:105
variant Term::TupleType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:108
variant Term::RuntimeExtension, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:114
variant Term::RuntimeFunction, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:120
variant Term::RuntimeSum, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:124
variant Term::ConstType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:177
variant Term::RuntimeType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:87
variant Term::StaticType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:89
variant Term::BoundedNatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:95
variant Term::StringType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:97
variant Term::BytesType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:99
variant Term::FloatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:101
variant Term::ListType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:105
variant Term::TupleType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:108
variant Term::RuntimeExtension, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:114
variant Term::RuntimeFunction, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:120
variant Term::RuntimeSum, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:124
variant Term::ConstType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:177
variant Term::RuntimeType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:87
variant Term::StaticType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:89
variant Term::BoundedNatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:95
variant Term::StringType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:97
variant Term::BytesType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:99
variant Term::FloatType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:101
variant Term::ListType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:105
variant Term::TupleType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:108
variant Term::RuntimeExtension, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:114
variant Term::RuntimeFunction, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:120
variant Term::RuntimeSum, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:124
variant Term::ConstType, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:177

--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself 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.47.0/src/lints/function_missing.ron

Failed in:
function hugr_core::types::type_param::check_term_types, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:807
function hugr_core::types::type_param::check_term_type, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/types/type_param.rs:738

   Summary semver requires new major version: 2 major and 0 minor checks failed
  Finished [  50.141s] hugr-core
  Building hugr-llvm v0.27.0 (current)
     Built [  29.328s] (current)
   Parsing hugr-llvm v0.27.0 (current)
    Parsed [   0.012s] (current)
  Building hugr-llvm v0.27.0 (baseline)
     Built [  29.088s] (baseline)
   Parsing hugr-llvm v0.27.0 (baseline)
    Parsed [   0.012s] (baseline)
  Checking hugr-llvm v0.27.0 -> v0.27.0 (assume minor change)
   Checked [   0.040s] 196 checks: 196 pass, 56 skip
   Summary no semver update required
  Finished [  59.543s] hugr-llvm
  Building hugr-model v0.27.0 (current)
     Built [  10.649s] (current)
   Parsing hugr-model v0.27.0 (current)
    Parsed [   0.016s] (current)
  Building hugr-model v0.27.0 (baseline)
     Built [  10.803s] (baseline)
   Parsing hugr-model v0.27.0 (baseline)
    Parsed [   0.016s] (baseline)
  Checking hugr-model v0.27.0 -> v0.27.0 (assume minor change)
   Checked [   0.029s] 196 checks: 196 pass, 56 skip
   Summary no semver update required
  Finished [  22.100s] hugr-model
  Building hugr-persistent v0.6.0 (current)
     Built [  22.245s] (current)
   Parsing hugr-persistent v0.6.0 (current)
    Parsed [   0.008s] (current)
  Building hugr-persistent v0.6.0 (baseline)
     Built [  22.289s] (baseline)
   Parsing hugr-persistent v0.6.0 (baseline)
    Parsed [   0.007s] (baseline)
  Checking hugr-persistent v0.6.0 -> v0.6.0 (assume minor change)
   Checked [   0.012s] 196 checks: 196 pass, 56 skip
   Summary no semver update required
  Finished [  45.292s] hugr-persistent

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