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

feat!: Disallow nonlocal value edges into FuncDefn's #1061

Merged
merged 6 commits into from
May 24, 2024

Conversation

acl-cqc
Copy link
Contributor

@acl-cqc acl-cqc commented May 15, 2024

Closes #936

Test for ext edges only in this PR. (Would be good to have one for dom edges too but that can follow.)

BREAKING CHANGE: Hugr's with nonlocal ("Inter-Graph") edges that enter FuncDefns will now fail validation

@acl-cqc acl-cqc requested a review from a team as a code owner May 15, 2024 22:19
@acl-cqc acl-cqc requested a review from mark-koch May 15, 2024 22:19
@acl-cqc acl-cqc changed the title feat!:Disallow nonlocal value edges into FuncDefn's feat!: Disallow nonlocal value edges into FuncDefn's May 15, 2024
Copy link

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 82.97872% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 86.58%. Comparing base (1c422ab) to head (100ad00).
Report is 4 commits behind head on main.

Files Patch % Lines
hugr/src/hugr/validate/test.rs 76.66% 0 Missing and 7 partials ⚠️
hugr/src/hugr/validate.rs 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1061      +/-   ##
==========================================
+ Coverage   86.26%   86.58%   +0.31%     
==========================================
  Files          82       83       +1     
  Lines       17236    17594     +358     
  Branches    17236    17594     +358     
==========================================
+ Hits        14869    15234     +365     
+ Misses       1547     1532      -15     
- Partials      820      828       +8     
Flag Coverage Δ
rust 86.58% <82.97%> (+0.31%) ⬆️

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.

Copy link
Contributor

@mark-koch mark-koch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

hugr/src/hugr/validate/test.rs Outdated Show resolved Hide resolved
@acl-cqc
Copy link
Contributor Author

acl-cqc commented May 16, 2024

I fiddled the order of things so that if you have an edge that enters just a FuncDefn, you'll get the "no edge into funcdefn" error; previously you'd have got the "missing order edge" error (and you can't actually add the order edge to the funcdefn, as you would need to do to get the "no edge into funcdefn" error, because funcdefns can't receive order edges).

The test for that can't be constructed with the builder (because the builder always tries to add the order edge, and fails), so would have to duplicate most of test_ext_edge. Which doesn't feel worth it to check we've slightly-improved an error message :(. I'm hoping this way is acceptable for being simpler anyway :)...

@acl-cqc acl-cqc requested a review from mark-koch May 16, 2024 16:15
@acl-cqc acl-cqc added this pull request to the merge queue May 24, 2024
Merged via the queue into main with commit 9ff6dce May 24, 2024
18 checks passed
@acl-cqc acl-cqc deleted the feat/no_value_edge_into_func branch May 24, 2024 15:39
This was referenced May 23, 2024
github-merge-queue bot pushed a commit that referenced this pull request May 29, 2024
## 🤖 New release
* `hugr`: 0.4.0 -> 0.5.0
* `hugr-cli`: 0.1.0
* `hugr-core`: 0.1.0
* `hugr-passes`: 0.1.0

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

## `hugr`
<blockquote>

## 0.5.0 (2024-05-29)

### Bug Fixes

- Missing re-exports in `hugr::hugr`
([#1127](#1127))
- Set initial version of hugr-core to 0.1.0
([#1129](#1129))

### Features

- [**breaking**] Remove `PartialEq` impl for `ConstF64`
([#1079](#1079))
- [**breaking**] Allow "Row Variables" declared as List<Type>
([#804](#804))
- Hugr binary cli tool ([#1096](#1096))
- [**breaking**] Move passes from `algorithms` into a separate crate
([#1100](#1100))
- [**breaking**] Disallow nonlocal value edges into FuncDefn's
([#1061](#1061))
- [**breaking**] Move cli in to hugr-cli sub-crate
([#1107](#1107))
- Add verbosity, return `Hugr` from `run`.
([#1116](#1116))
- Unseal and make public the traits `HugrInternals` and
`HugrMutInternals` ([#1122](#1122))

### Refactor

- [**breaking**] No Ports in TypeRow
([#1087](#1087))
- Add a `hugr-core` crate
([#1108](#1108))
</blockquote>

## `hugr-core`
<blockquote>

## 0.1.0 (2024-05-29)

### Bug Fixes

- Set initial version of hugr-core to 0.1.0
([#1129](#1129))

### Features

- [**breaking**] Move cli in to hugr-cli sub-crate
([#1107](#1107))
- Make internals of int ops and the "int" CustomType more public.
([#1114](#1114))
- Unseal and make public the traits `HugrInternals` and
`HugrMutInternals` ([#1122](#1122))

### Refactor

- Add a `hugr-core` crate
([#1108](#1108))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

---------

Co-authored-by: Agustin Borgna <[email protected]>
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.

No edges into FuncDefn's
2 participants