-
Notifications
You must be signed in to change notification settings - Fork 5
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
[bugfix] Non-local edges: fix validation, Consts inside CFG, no Static Dom edges #258
Conversation
// Inter-graph constant wires do not have restrictions | ||
EdgeKind::Static(typ) => { | ||
if let OpType::Const(ops::Const(val)) = from_optype { | ||
return typecheck_const(&typ, val).map_err(ValidationError::from); | ||
typecheck_const(&typ, val).map_err(ValidationError::from)?; |
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 do wonder if this should go in validate_operation
. Admittedly there is nothing else there like it (but nor anywhere else that I can see - am I missing somewhere?)
} else { | ||
Err(InterGraphEdgeError::InvalidConstSrc { | ||
if !OpTag::Function.is_superset(from_optype.tag()) { | ||
return Err(InterGraphEdgeError::InvalidConstSrc { |
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'm also not really sure about this check. If a node says its other
port/edgekind is static, isn't that sufficient - do we really mean to restrict only const/function nodes to doing that here?
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.
It does actually say this in the spec but just seems a bit weird: https://github.com/CQCL-DEV/hugr/blob/main/specification/hugr.md#static-edges
src/hugr/validate.rs
Outdated
})?; | ||
// External edge. | ||
if !is_static { | ||
// Must have an order edge§ |
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.
// Must have an order edge§ | |
// Must have an order edge. |
Fixes #231