Struct erg_compiler::ty::SubrType
source · pub struct SubrType {
pub kind: SubrKind,
pub non_default_params: Vec<ParamTy>,
pub var_params: Option<Box<ParamTy>>,
pub default_params: Vec<ParamTy>,
pub kw_var_params: Option<Box<ParamTy>>,
pub return_t: Box<Type>,
}
Expand description
e.g. (x: Int, ?base: Int) -> Int => SubrTy{ kind: Func, non_default_params: [x: Int], default_params: [base: Int] return_t: Int }
Fields§
§kind: SubrKind
§non_default_params: Vec<ParamTy>
§var_params: Option<Box<ParamTy>>
§default_params: Vec<ParamTy>
§kw_var_params: Option<Box<ParamTy>>
§return_t: Box<Type>
Implementations§
source§impl SubrType
impl SubrType
pub fn new( kind: SubrKind, non_default_params: Vec<ParamTy>, var_params: Option<ParamTy>, default_params: Vec<ParamTy>, kw_var_params: Option<ParamTy>, return_t: Type ) -> Self
pub fn contains_tvar(&self, target: &FreeTyVar) -> bool
pub fn contains_type(&self, target: &Type) -> bool
pub fn contains_tp(&self, target: &TyParam) -> bool
pub fn qvars(&self) -> Set<(Str, Constraint)>
sourcepub fn essential_qnames(&self) -> Set<Str>
pub fn essential_qnames(&self) -> Set<Str>
essential_qnames(|T, U| (T, U) -> Int) == {}
essential_qnames(|T, U| (T, U) -> (T, U)) == {T, U}
essential_qnames(|T, A| (T) -> A(<: T)) == {T}
essential_qnames(|T, U| (T, T) -> U) == {T}
pub fn has_qvar(&self) -> bool
pub fn has_unbound_var(&self) -> bool
pub fn has_undoable_linked_var(&self) -> bool
pub fn typarams(&self) -> Vec<TyParam>
pub fn self_t(&self) -> Option<&Type>
pub fn mut_self_t(&mut self) -> Option<&mut Type>
pub fn is_method(&self) -> bool
pub fn non_var_params(&self) -> impl Iterator<Item = &ParamTy> + Clone
sourcepub fn pos_params(&self) -> impl Iterator<Item = &ParamTy> + Clone
pub fn pos_params(&self) -> impl Iterator<Item = &ParamTy> + Clone
WARN: This is an infinite iterator
self
is not included
pub fn param_names(&self) -> impl Iterator<Item = &str> + Clone
pub fn param_ts(&self) -> impl Iterator<Item = &Type> + Clone
pub fn is_no_var(&self) -> bool
pub fn derefine(&self) -> Self
pub fn args_ownership(&self) -> ArgsOwnership
Trait Implementations§
source§impl LimitedDisplay for SubrType
impl LimitedDisplay for SubrType
source§impl PartialEq for SubrType
impl PartialEq for SubrType
source§impl StructuralEq for SubrType
impl StructuralEq for SubrType
fn structural_eq(&self, other: &Self) -> bool
impl Eq for SubrType
impl StructuralPartialEq for SubrType
Auto Trait Implementations§
impl Freeze for SubrType
impl RefUnwindSafe for SubrType
impl Send for SubrType
impl Sync for SubrType
impl Unpin for SubrType
impl UnwindSafe for SubrType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more