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 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>
§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>, return_t: Type ) -> Self
pub fn contains_tvar(&self, target: &FreeTyVar) -> bool
pub fn contains(&self, target: &Type) -> 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}