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!: rename HugrView function type methods + simplify behaviour #1265

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Jul 5, 2024

Closes #957

  • mono_fn_type now enforces function value monomorphism
  • get_df_function_type -> inner_function_type so it matches the actual op function being called more obviously.
  • The culprit get_function_type changed to poly_func_type which only reports polymorphic type from func defn/decl

BREAKING CHANGE:

  • rename get_df_function_type to inner_function_type
  • get_function_type replaced with poly_func_type which only reports polymorphic function type for Func(Defn/Decl) rooted HUGRs

@ss2165 ss2165 requested a review from a team as a code owner July 5, 2024 13:50
@ss2165 ss2165 requested review from aborgna-q and acl-cqc and removed request for aborgna-q July 5, 2024 13:50
@@ -326,14 +326,15 @@ pub enum ConstTypeError {

/// Hugrs (even functions) inside Consts must be monomorphic
fn mono_fn_type(h: &Hugr) -> Result<FunctionType, ConstTypeError> {
Copy link
Member Author

Choose a reason for hiding this comment

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

this function just matches existing behaviour - this PR does not address the question of what a valid monomorphic function value hugr root type is

Copy link
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

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

LGTM

The failed test should get fixed with #1263.
Mermaid rendering was not considered a breaking chance :/

Closes #957

- `mono_fn_type` now enforces function value monomorphism
- get_df_function_type -> inner_function_type so it matches the actual op function being called more obviously.
- The culprit `get_function_type` changed to `poly_func_type` which _only_ reports polymorphic typr from func defn/decl

refactor(hugr-core): rename `get_df_function_type`
BREAKING-CHANGE: rename `get_df_function_type` to `inner_function_type`

refactor(hugr-core): `get_function_type` replaced with `poly_func_type` which only reports polymorphic function type for Func(Defn/Decl) rooted HUGRs
@ss2165 ss2165 enabled auto-merge July 5, 2024 14:06
@ss2165 ss2165 added this pull request to the merge queue Jul 5, 2024
Merged via the queue into main with commit defd2bb Jul 5, 2024
18 checks passed
@ss2165 ss2165 deleted the ss/no-get-f branch July 5, 2024 14:09
@hugrbot hugrbot mentioned this pull request Jul 5, 2024
@acl-cqc
Copy link
Contributor

acl-cqc commented Jul 8, 2024

LGTM, thanks @ss2165

github-merge-queue bot pushed a commit that referenced this pull request Jul 10, 2024
## 🤖 New release
* `hugr`: 0.6.1 -> 0.7.0
* `hugr-core`: 0.3.1 -> 0.4.0
* `hugr-passes`: 0.3.0 -> 0.4.0
* `hugr-cli`: 0.1.2 -> 0.1.3

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

## `hugr`
<blockquote>

## 0.7.0 (2024-07-10)

### Bug Fixes

- Bring back input_extensions serialized field in rust NodeSer
([#1275](#1275))
- [**breaking**] `ops::Module` now empty struct rather than unit struct
([#1271](#1271))

### Features

- Add `force_order` pass.
([#1285](#1285))
- [**breaking**] `MakeOpDef` has new `extension` method.
([#1266](#1266))

### Refactor

- [**breaking**] Remove `Value::Tuple`
([#1255](#1255))
- [**breaking**] Rename `HugrView` function type methods + simplify
behaviour ([#1265](#1265))

### Styling

- Change "serialise" etc to "serialize" etc.
([#1251](#1251))

### Testing

- Add a test for [#1257](#1257)
([#1260](#1260))
</blockquote>

## `hugr-core`
<blockquote>

## 0.4.0 (2024-07-10)

### Bug Fixes

- Bring back input_extensions serialized field in rust NodeSer
([#1275](#1275))
- [**breaking**] `ops::Module` now empty struct rather than unit struct
([#1271](#1271))

### Features

- [**breaking**] `MakeOpDef` has new `extension` method.
([#1266](#1266))

### Refactor

- [**breaking**] Remove `Value::Tuple`
([#1255](#1255))
- [**breaking**] Rename `HugrView` function type methods + simplify
behaviour ([#1265](#1265))

### Styling

- Change "serialise" etc to "serialize" etc.
([#1251](#1251))

### Testing

- Add a test for [#1257](#1257)
([#1260](#1260))
</blockquote>

## `hugr-passes`
<blockquote>

## 0.4.0 (2024-07-10)

### Features

- Add `force_order` pass.
([#1285](#1285))

### Refactor

- [**breaking**] Remove `Value::Tuple`
([#1255](#1255))
</blockquote>

## `hugr-cli`
<blockquote>

## 0.1.3 (2024-07-10)

### Styling

- Change "serialise" etc to "serialize" etc.
([#1251](#1251))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).
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.

HugrView::get_function_type makes no sense
3 participants