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

fix: No dataflow_signature for block types #792

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/hugr/rewrite/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,9 @@ mod test {
inputs: vec![listy.clone()].into(),
tuple_sum_rows: vec![type_row![]],
other_outputs: vec![listy.clone()].into(),
extension_delta: ExtensionSet::singleton(&collections::EXTENSION_NAME),
// This should be ExtensionSet::singleton(&collections::EXTENSION_NAME),
// at least when https://github.com/CQCL/issues/388 is fixed
extension_delta: ExtensionSet::new(),
},
)?;
let r_df1 = replacement.add_node_with_parent(
Expand Down
12 changes: 3 additions & 9 deletions src/ops/controlflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use smol_str::SmolStr;

use crate::extension::ExtensionSet;
use crate::types::{EdgeKind, FunctionType, Type, TypeRow};
use crate::{type_row, Direction};
use crate::Direction;

use super::dataflow::{DataflowOpTrait, DataflowParent};
use super::OpTag;
Expand Down Expand Up @@ -179,10 +179,8 @@ impl OpTrait for DataflowBlock {
Some(EdgeKind::ControlFlow)
}

fn dataflow_signature(&self) -> Option<FunctionType> {
Some(
FunctionType::new(type_row![], type_row![]).with_extension_delta(&self.extension_delta),
)
fn extension_delta(&self) -> ExtensionSet {
self.extension_delta.clone()
}

fn non_df_port_count(&self, dir: Direction) -> usize {
Expand Down Expand Up @@ -210,10 +208,6 @@ impl OpTrait for ExitBlock {
Some(EdgeKind::ControlFlow)
}

fn dataflow_signature(&self) -> Option<FunctionType> {
Some(FunctionType::new(type_row![], type_row![]))
}

fn non_df_port_count(&self, dir: Direction) -> usize {
match dir {
Direction::Incoming => 1,
Expand Down
Loading