Skip to content
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

refactor!: Bring the collections ext in line with other extension defs #1469

Merged
merged 4 commits into from
Aug 27, 2024

Conversation

aborgna-q
Copy link
Collaborator

@aborgna-q aborgna-q commented Aug 27, 2024

Refactors the list operations definition so it's easier to add new ones (#1467), and to bring it in line with the other extension definitions.

  • Make the operation enum variants camelCase, to match their op names. This lets us us strum to auto-derive all the string conversions.
  • Implemented MakeOpDef, MakeRegisteredOp,

BREAKING CHANGE: Renamed ListOp variants to camelCase. collections::EXTENSION_NAME is now called EXTENSION_ID.

@aborgna-q aborgna-q marked this pull request as ready for review August 27, 2024 11:49
@aborgna-q aborgna-q requested a review from a team as a code owner August 27, 2024 11:49
@aborgna-q aborgna-q requested a review from ss2165 August 27, 2024 11:49
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 88.18182% with 13 lines in your changes missing coverage. Please review.

Project coverage is 87.65%. Comparing base (001e66a) to head (9c646b3).
Report is 2 commits behind head on main.

Files Patch % Lines
hugr-core/src/std_extensions/collections.rs 86.84% 7 Missing and 3 partials ⚠️
...r-core/src/std_extensions/collections/list_fold.rs 89.28% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1469      +/-   ##
==========================================
- Coverage   87.68%   87.65%   -0.04%     
==========================================
  Files         121      122       +1     
  Lines       20806    20819      +13     
  Branches    17949    17962      +13     
==========================================
+ Hits        18243    18248       +5     
- Misses       1794     1800       +6     
- Partials      769      771       +2     
Flag Coverage Δ
python 91.31% <ø> (ø)
rust 87.06% <88.18%> (-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.

}

/// Returns a generic unbounded type for a list element.
fn elem_type(self) -> Type {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't need to be a method

@aborgna-q aborgna-q added this pull request to the merge queue Aug 27, 2024
Merged via the queue into main with commit 069abd7 Aug 27, 2024
22 checks passed
@aborgna-q aborgna-q deleted the ab/refactor-list-ext branch August 27, 2024 16:15
@hugrbot hugrbot mentioned this pull request Aug 27, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 30, 2024
Closes #1467.

~~Blocked by #1469~~

BREAKING CHANGE: `ListOp::pop` now returns an option.
This was referenced Aug 30, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 30, 2024
## 🤖 New release
* `hugr`: 0.11.0 -> 0.12.0
* `hugr-core`: 0.8.0 -> 0.9.0
* `hugr-passes`: 0.7.0 -> 0.8.0
* `hugr-cli`: 0.4.0 -> 0.5.0

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

## `hugr`
<blockquote>

## 0.12.0 (2024-08-30)

### Features

- [**breaking**] Disallow opaque ops during validation
([#1431](#1431))
- [**breaking**] Add collections to serialized standard extensions
([#1452](#1452))
- [**breaking**] Variadic logic ops now binary
([#1451](#1451))
- [**breaking**] Int operations other than widen/narrow have only one
width arg ([#1455](#1455))
- Add a `FuncTypeBase::io` method
([#1458](#1458))
- Add missing ops ([#1463](#1463))
- [**breaking**] Move `Lift`, `MakeTuple`, `UnpackTuple` and `Lift` to
prelude ([#1475](#1475))
- `Option` / `Result` helpers
([#1481](#1481))
- [**breaking**] Add more list operations
([#1474](#1474))
- [**breaking**] Move int conversions to `conversions` ext, add to/from
usize ([#1490](#1490))
- Fill out array ops ([#1491](#1491))

### Refactor

- [**breaking**] Bring the collections ext in line with other extension
defs ([#1469](#1469))
- [**breaking**] Make Either::Right the "success" case
([#1489](#1489))
- [**breaking**] Flatten `CustomOp` in to `OpType`
([#1429](#1429))

### Testing

- Add serialization benchmarks
([#1439](#1439))
</blockquote>

## `hugr-core`
<blockquote>

## 0.9.0 (2024-08-30)

### Features

- [**breaking**] Disallow opaque ops during validation
([#1431](#1431))
- [**breaking**] Add collections to serialized standard extensions
([#1452](#1452))
- [**breaking**] Variadic logic ops now binary
([#1451](#1451))
- [**breaking**] Int operations other than widen/narrow have only one
width arg ([#1455](#1455))
- Add a `FuncTypeBase::io` method
([#1458](#1458))
- Add missing ops ([#1463](#1463))
- [**breaking**] Move `Lift`, `MakeTuple`, `UnpackTuple` and `Lift` to
prelude ([#1475](#1475))
- `Option` / `Result` helpers
([#1481](#1481))
- [**breaking**] Add more list operations
([#1474](#1474))
- [**breaking**] Move int conversions to `conversions` ext, add to/from
usize ([#1490](#1490))
- Fill out array ops ([#1491](#1491))

### Refactor

- [**breaking**] Flatten `CustomOp` in to `OpType`
([#1429](#1429))
- [**breaking**] Bring the collections ext in line with other extension
defs ([#1469](#1469))
- [**breaking**] Make Either::Right the "success" case
([#1489](#1489))
</blockquote>

## `hugr-passes`
<blockquote>

## 0.8.0 (2024-08-30)

### Features

- [**breaking**] Variadic logic ops now binary
([#1451](#1451))
- [**breaking**] Int operations other than widen/narrow have only one
width arg ([#1455](#1455))
- [**breaking**] Move `Lift`, `MakeTuple`, `UnpackTuple` and `Lift` to
prelude ([#1475](#1475))
- [**breaking**] Add more list operations
([#1474](#1474))
- [**breaking**] Move int conversions to `conversions` ext, add to/from
usize ([#1490](#1490))

### Refactor

- [**breaking**] Flatten `CustomOp` in to `OpType`
([#1429](#1429))
- [**breaking**] Bring the collections ext in line with other extension
defs ([#1469](#1469))
- [**breaking**] Make Either::Right the "success" case
([#1489](#1489))
</blockquote>

## `hugr-cli`
<blockquote>

## 0.5.0 (2024-08-30)

### Features

- [**breaking**] Add collections to serialized standard extensions
([#1452](#1452))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).
@hugrbot hugrbot mentioned this pull request Sep 3, 2024
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