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: Improve error message on failed custom op validation #1416

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

aborgna-q
Copy link
Collaborator

Prints the node and operation in the error message.

Before:

$ hugr validate test.hugr
Error validating HUGR: Type arguments of node did not match params declared by definition: Wrong number of type arguments: 1 vs expected 0 declared type parameters

After:

$ hugr validate test.hugr
Error validating HUGR: Error in signature of operation 'Not' in Node(27): Type arguments of node did not match params declared by definition: Wrong number of type arguments: 1 vs expected 0 declared type parameters

@aborgna-q aborgna-q requested a review from a team as a code owner August 12, 2024 13:31
@aborgna-q aborgna-q requested a review from zrho August 12, 2024 13:31
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.

Project coverage is 87.66%. Comparing base (67bb8a0) to head (47fa4b0).

Files Patch % Lines
hugr-core/src/ops/custom.rs 22.22% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1416      +/-   ##
==========================================
- Coverage   87.67%   87.66%   -0.02%     
==========================================
  Files         118      118              
  Lines       20424    20431       +7     
  Branches    18042    18049       +7     
==========================================
+ Hits        17906    17910       +4     
- Misses       1727     1729       +2     
- Partials      791      792       +1     
Flag Coverage Δ
python 91.81% <ø> (ø)
rust 87.11% <22.22%> (-0.02%) ⬇️

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.

@aborgna-q aborgna-q added this pull request to the merge queue Aug 12, 2024
Merged via the queue into main with commit 6639c52 Aug 12, 2024
21 of 22 checks passed
@aborgna-q aborgna-q deleted the ab/wrong-params-error-msg branch August 12, 2024 13:53
@hugrbot hugrbot mentioned this pull request Aug 12, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 12, 2024
## 🤖 New release
* `hugr`: 0.10.0 -> 0.11.0
* `hugr-core`: 0.7.0 -> 0.8.0
* `hugr-passes`: 0.6.2 -> 0.7.0
* `hugr-cli`: 0.3.0 -> 0.4.0

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

## `hugr`
<blockquote>

## 0.11.0 (2024-08-12)

### Bug Fixes

- [**breaking**] BasicBlockExits should not be `OpTag::DataflowParent`
([#1409](#1409))

### Documentation

- Clarify CustomConst::equal_consts
([#1396](#1396))

### Features

- [**breaking**] Serialised extensions
([#1371](#1371))
- Serialised standard extensions
([#1377](#1377))
- [**breaking**] Update remaining builder methods to "infer by default"
([#1386](#1386))
- Add Eq op to logic extension
([#1398](#1398))
- Improve error message on failed custom op validation
([#1416](#1416))
- [**breaking**] `Extension` requires a version
([#1367](#1367))
</blockquote>

## `hugr-core`
<blockquote>

## 0.8.0 (2024-08-12)

### Bug Fixes

- [**breaking**] BasicBlockExits should not be `OpTag::DataflowParent`
([#1409](#1409))

### Documentation

- Clarify CustomConst::equal_consts
([#1396](#1396))

### Features

- [**breaking**] `Extension` requires a version
([#1367](#1367))
- [**breaking**] Serialised extensions
([#1371](#1371))
- Serialised standard extensions
([#1377](#1377))
- [**breaking**] Update remaining builder methods to "infer by default"
([#1386](#1386))
- Add Eq op to logic extension
([#1398](#1398))
- Improve error message on failed custom op validation
([#1416](#1416))
</blockquote>

## `hugr-passes`
<blockquote>

## 0.7.0 (2024-08-12)

### Features

- [**breaking**] `Extension` requires a version
([#1367](#1367))
</blockquote>

## `hugr-cli`
<blockquote>

## 0.4.0 (2024-08-12)

### Features

- Serialised standard extensions
([#1377](#1377))
- Validate with extra extensions and packages
([#1389](#1389))
- [**breaking**] Move mermaid to own sub-command
([#1390](#1390))
</blockquote>


</p></details>

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

---------

Co-authored-by: Craig Roy <craig.roy@cambridgequantum.com>
@hugrbot hugrbot mentioned this pull request Aug 13, 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