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

chore(deps): Update hugr dependency to 0.3.0 #313

Merged
merged 7 commits into from
Apr 19, 2024
Merged

Conversation

aborgna-q
Copy link
Collaborator

No description provided.

@aborgna-q aborgna-q requested a review from acl-cqc April 16, 2024 10:25
Copy link

codecov bot commented Apr 16, 2024

Codecov Report

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

Project coverage is 84.98%. Comparing base (65045b2) to head (86ff3f5).

Files Patch % Lines
tket2/src/json/op.rs 36.66% 19 Missing ⚠️
tket2/src/ops.rs 60.00% 6 Missing ⚠️
tket2/src/json/encoder.rs 66.66% 2 Missing ⚠️
tket2/src/circuit/hash.rs 0.00% 0 Missing and 1 partial ⚠️
tket2/src/circuit/units.rs 50.00% 0 Missing and 1 partial ⚠️
tket2/src/passes/commutation.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #313      +/-   ##
==========================================
+ Coverage   84.86%   84.98%   +0.11%     
==========================================
  Files          35       35              
  Lines        4473     4442      -31     
  Branches     4321     4290      -31     
==========================================
- Hits         3796     3775      -21     
- Misses        486      487       +1     
+ Partials      191      180      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@acl-cqc acl-cqc left a comment

Choose a reason for hiding this comment

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

Looks good, thanks Agustin. This is nice as a summary of all the changes from 0.2 to 0.3, and great to see how much guff is disappearing and the API is becoming easier to use :)

@@ -147,10 +147,10 @@ where
Direction::Outgoing => sig.output,
Direction::Incoming => sig.input,
};
if let Some(EdgeKind::Static(static_type)) = optype.static_port_kind(direction) {
if let Some(EdgeKind::Const(static_type)) = optype.static_port_kind(direction) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you don't want to include EdgeKind::Function here - in that case I'd suggest a comment saying so, the "TODO: This is quite hacky, but we need it to accept Const static inputs" is a step in that suggestion but you might want to explicitly say "not Function" ;-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a TODO comment about it

_ => LeafOp::CustomOp(Box::new(json_op.as_opaque_op())).into(),
JsonOpType::noop => {
// TODO: Replace with `Noop::new` once that is published.
let mut noop = Noop::default();
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I'd use Noop {ty: QB_T} rather than mutation, but this is into super-nit territory, your TODO is a better plan :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can't do that since Noop is non_exhaustive. Hence the need for ::new.


let json_optype = if let Ok(tk2op) = leaf.try_into() {
let json_optype = if let Ok(tk2op) = op.try_into() {
Copy link
Contributor

@acl-cqc acl-cqc Apr 19, 2024

Choose a reason for hiding this comment

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

driveby: this is a bit confusing - you do let json_optype = if ... making me think there'll be some other value assigned if op.try_into() fails, but (eventually, after a long if-true block) the other branches both just return. I think you could make this clearer if you started with let OK(tk2op) = op.try_into() else {return ...} and put both the alternatives inside that else.

(Then the big match tk2op - but you might move that out into a helper function, i.e. of type TK2Op -> JsonOpType.)

Also, you might want to inline singly-used err().

OpType::LeafOp(leaf)
if leaf
OpType::CustomOp(custom_op)
if custom_op
.as_extension_op()
.map(|ext| ext.args().is_empty())
.unwrap_or_default() =>
Copy link
Contributor

Choose a reason for hiding this comment

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

driveby nit, but can I suggest unwrap_or(false) or unwrap_or(true) here for clarity/explicitness

};
op == t2_op.into()
})
.filter(|n| circ.get_optype(*n) == &t2_op)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is one of the best examples! 👍 👍

@aborgna-q aborgna-q added this pull request to the merge queue Apr 19, 2024
Merged via the queue into main with commit 40e79d9 Apr 19, 2024
10 of 11 checks passed
@aborgna-q aborgna-q deleted the chore/update-deps-rc branch April 19, 2024 12:59
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