Skip to content

Commit

Permalink
Clarify bound in Type::new_(,row_)var_use
Browse files Browse the repository at this point in the history
  • Loading branch information
acl-cqc committed May 15, 2024
1 parent 98cf6af commit 4a41f96
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hugr/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,19 @@ impl Type {
}

/// New use (occurrence) of the type variable with specified index.
/// For use in type schemes only: `bound` must match that with which the
/// variable was declared (i.e. as a [TypeParam::Type]`(bound)`).
/// `bound` must be exactly that with which the variable was declared
/// (i.e. as a [TypeParam::Type]`(bound)`), which may be narrower
/// than required for the use.
pub const fn new_var_use(idx: usize, bound: TypeBound) -> Self {
Self(TypeEnum::Variable(idx, bound), bound)
}

/// New use (occurrence) of the row variable with specified index.
/// `bound` must match that with which the variable was declared
/// (i.e. as a [TypeParam::List]` of a `[TypeParam::Type]` of that bound).
/// For use in [OpDef], not [FuncDefn], type schemes only.
/// `bound` must be exactly that with which the variable was declared
/// (i.e. as a [TypeParam::List]` of a `[TypeParam::Type]` of that bound),
/// which may be narrower than required for the use.
/// For use in [OpDef] type schemes, or function types, only,
/// not [FuncDefn] type schemes or as a Hugr port type.
///
/// [OpDef]: crate::extension::OpDef
/// [FuncDefn]: crate::ops::FuncDefn
Expand Down

0 comments on commit 4a41f96

Please sign in to comment.