Skip to content

Commit

Permalink
Cleanup unneeded method
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Aug 27, 2024
1 parent c675845 commit e72e8dd
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions hugr-core/src/std_extensions/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ impl ListOp {
/// Compute the signature of the operation, given the list type definition.
fn compute_signature(self, list_type_def: &TypeDef) -> SignatureFunc {
use ListOp::*;
let e = self.elem_type();
let l = self.list_type(list_type_def);
let e = Type::new_var_use(0, TypeBound::Any);
let l = self.list_type(list_type_def, 0);
match self {
pop => self
.list_polytype(vec![l.clone()], vec![l.clone(), e.clone()])
Expand All @@ -150,16 +150,11 @@ impl ListOp {
PolyFuncTypeRV::new(vec![Self::TP], FuncValueType::new(input, output))
}

/// Returns a generic unbounded type for a list element.
fn elem_type(self) -> Type {
Type::new_var_use(0, TypeBound::Any)
}

/// Returns the type of a generic list.
fn list_type(self, list_type_def: &TypeDef) -> Type {
/// Returns the type of a generic list, associated with the element type parameter at index `idx`.
fn list_type(self, list_type_def: &TypeDef, idx: usize) -> Type {
Type::new_extension(
list_type_def
.instantiate(vec![TypeArg::new_var_use(0, Self::TP)])
.instantiate(vec![TypeArg::new_var_use(idx, Self::TP)])
.unwrap(),
)
}
Expand Down

0 comments on commit e72e8dd

Please sign in to comment.