Skip to content

Commit

Permalink
<Self as Buildable>::Base -> B/T (whatever type param is)
Browse files Browse the repository at this point in the history
  • Loading branch information
acl-cqc committed Jul 25, 2023
1 parent d82c093 commit 91d07bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/builder/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<B: HugrMut> CFGBuilder<B> {
inputs: SimpleRow,
predicate_variants: Vec<ClassicRow>,
other_outputs: SimpleRow,
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
) -> Result<BlockBuilder<&mut B>, BuildError> {
self.any_block_builder(inputs, predicate_variants, other_outputs, false)
}

Expand All @@ -139,7 +139,7 @@ impl<B: HugrMut> CFGBuilder<B> {
predicate_variants: Vec<ClassicRow>,
other_outputs: SimpleRow,
entry: bool,
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
) -> Result<BlockBuilder<&mut B>, BuildError> {
let op = OpType::BasicBlock(BasicBlock::DFB {
inputs: inputs.clone(),
other_outputs: other_outputs.clone(),
Expand Down Expand Up @@ -173,7 +173,7 @@ impl<B: HugrMut> CFGBuilder<B> {
inputs: SimpleRow,
outputs: SimpleRow,
n_cases: usize,
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
) -> Result<BlockBuilder<&mut B>, BuildError> {
self.block_builder(inputs, vec![type_row![]; n_cases], outputs)
}

Expand All @@ -188,7 +188,7 @@ impl<B: HugrMut> CFGBuilder<B> {
&mut self,
predicate_variants: Vec<ClassicRow>,
other_outputs: SimpleRow,
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
) -> Result<BlockBuilder<&mut B>, BuildError> {
let inputs = self
.inputs
.take()
Expand All @@ -206,7 +206,7 @@ impl<B: HugrMut> CFGBuilder<B> {
&mut self,
outputs: SimpleRow,
n_cases: usize,
) -> Result<BlockBuilder<&mut <Self as Buildable>::Base>, BuildError> {
) -> Result<BlockBuilder<&mut B>, BuildError> {
self.entry_builder(vec![type_row![]; n_cases], outputs)
}

Expand Down
5 changes: 1 addition & 4 deletions src/builder/conditional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ impl<B: HugrMut> ConditionalBuilder<B> {
///
/// This function will return an error if the case has already been built,
/// `case` is not a valid index or if there is an error adding nodes.
pub fn case_builder(
&mut self,
case: usize,
) -> Result<CaseBuilder<&mut <Self as Buildable>::Base>, BuildError> {
pub fn case_builder(&mut self, case: usize) -> Result<CaseBuilder<&mut B>, BuildError> {
let conditional = self.conditional_node;
let control_op = self.hugr().get_optype(self.conditional_node).clone();

Expand Down
2 changes: 1 addition & 1 deletion src/builder/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<T: HugrMut> ModuleBuilder<T> {
pub fn define_declaration(
&mut self,
f_id: &FuncID<false>,
) -> Result<FunctionBuilder<&mut <Self as Buildable>::Base>, BuildError> {
) -> Result<FunctionBuilder<&mut T>, BuildError> {
let f_node = f_id.node();
let (signature, name) = if let OpType::FuncDecl(ops::FuncDecl { signature, name }) =
self.hugr().get_optype(f_node)
Expand Down

0 comments on commit 91d07bb

Please sign in to comment.