-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
Codecov ReportAttention: Patch coverage is
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. |
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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" ;-)
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 :-)
There was a problem hiding this comment.
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
.
tket2/src/json/op.rs
Outdated
|
||
let json_optype = if let Ok(tk2op) = leaf.try_into() { | ||
let json_optype = if let Ok(tk2op) = op.try_into() { |
There was a problem hiding this comment.
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()
.
tket2/src/portmatching/matcher.rs
Outdated
OpType::LeafOp(leaf) | ||
if leaf | ||
OpType::CustomOp(custom_op) | ||
if custom_op | ||
.as_extension_op() | ||
.map(|ext| ext.args().is_empty()) | ||
.unwrap_or_default() => |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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! 👍 👍
No description provided.