Enum erg_compiler::ty::Type
source · [−]pub enum Type {
Show 40 variants
Obj,
Int,
Nat,
Ratio,
Float,
Bool,
Str,
NoneType,
Code,
Frame,
Error,
Inf,
NegInf,
Type,
ClassType,
TraitType,
Patch,
NotImplemented,
Ellipsis,
Never,
Mono(Str),
Ref(Box<Type>),
RefMut {
before: Box<Type>,
after: Option<Box<Type>>,
},
Subr(SubrType),
Callable {
param_ts: Vec<Type>,
return_t: Box<Type>,
},
Record(Dict<Field, Type>),
Refinement(RefinementType),
Quantified(QuantifiedType),
And(Box<Type>, Box<Type>),
Not(Box<Type>, Box<Type>),
Or(Box<Type>, Box<Type>),
Poly {
name: Str,
params: Vec<TyParam>,
},
MonoQVar(Str),
PolyQVar {
name: Str,
params: Vec<TyParam>,
},
Proj {
lhs: Box<Type>,
rhs: Str,
},
ProjCall {
lhs: Box<TyParam>,
attr_name: Str,
args: Vec<TyParam>,
},
FreeVar(FreeTyVar),
Failure,
Untyped,
Uninited,
}
Variants
Obj
Int
Nat
Ratio
Float
Bool
Str
NoneType
Code
Frame
Error
Inf
NegInf
Type
ClassType
TraitType
Patch
NotImplemented
Ellipsis
Never
Mono(Str)
Ref(Box<Type>)
RefMut
Subr(SubrType)
Callable
Record(Dict<Field, Type>)
Refinement(RefinementType)
Quantified(QuantifiedType)
And(Box<Type>, Box<Type>)
Not(Box<Type>, Box<Type>)
Or(Box<Type>, Box<Type>)
Poly
MonoQVar(Str)
PolyQVar
Proj
ProjCall
FreeVar(FreeTyVar)
Failure
Untyped
Uninited
used to represent TyParam
is not initialized (see erg_compiler::context::instantiate_tp
)
Implementations
sourceimpl Type
impl Type
pub const OBJ: &'static Self = _
pub const NONE: &'static Self = _
pub const NOT_IMPLEMENTED: &'static Self = _
pub const ELLIPSIS: &'static Self = _
pub const INF: &'static Self = _
pub const NEG_INF: &'static Self = _
pub const NEVER: &'static Self = _
pub const FAILURE: &'static Self = _
pub fn is_mono_q(&self) -> bool
pub fn is_simple_class(&self) -> bool
sourcepub fn is_procedure(&self) -> bool
pub fn is_procedure(&self) -> bool
Procedure
pub fn is_mut_type(&self) -> bool
pub fn is_nonelike(&self) -> bool
pub fn is_intersection_type(&self) -> bool
pub fn is_type(&self) -> bool
pub fn is_module(&self) -> bool
pub fn is_py_module(&self) -> bool
pub fn is_quantified(&self) -> bool
pub fn contains_tvar(&self, name: &str) -> bool
pub fn args_ownership(&self) -> ArgsOwnership
pub fn ownership(&self) -> Ownership
pub fn qual_name(&self) -> Str
pub fn local_name(&self) -> Str
sourcepub fn contains_intersec(&self, typ: &Type) -> bool
pub fn contains_intersec(&self, typ: &Type) -> bool
assert!((A and B).contains_intersec(B))
pub fn tvar_name(&self) -> Option<Str>
pub const fn is_free_var(&self) -> bool
pub const fn is_callable(&self) -> bool
pub fn is_unbound_var(&self) -> bool
sourcepub fn is_monomorphic(&self) -> bool
pub fn is_monomorphic(&self) -> bool
See also: is_monomorphized
sourcepub fn is_monomorphized(&self) -> bool
pub fn is_monomorphized(&self) -> bool
Set(Int, 3)
is not monomorphic but monomorphized
pub fn has_no_qvar(&self) -> bool
pub fn is_cachable(&self) -> bool
pub fn has_unbound_var(&self) -> bool
pub fn has_no_unbound_var(&self) -> bool
pub fn typarams_len(&self) -> Option<usize>
pub fn typarams(&self) -> Vec<TyParam>
pub fn self_t(&self) -> Option<&Type>
pub fn non_default_params(&self) -> Option<&Vec<ParamTy>>
pub fn var_args(&self) -> Option<&ParamTy>
pub fn default_params(&self) -> Option<&Vec<ParamTy>>
pub fn return_t(&self) -> Option<&Type>
pub fn mut_return_t(&mut self) -> Option<&mut Type>
pub fn update_constraint(&self, new_constraint: Constraint)
pub fn update_cyclicity(&self, new_cyclicity: Cyclicity)
pub fn derefine(&self) -> Type
Trait Implementations
sourceimpl From<RangeInclusive<&TyParam>> for Type
impl From<RangeInclusive<&TyParam>> for Type
sourcefn from(r: RangeInclusive<&TyParam>) -> Self
fn from(r: RangeInclusive<&TyParam>) -> Self
Converts to this type from the input type.
sourceimpl From<RangeInclusive<TyParam>> for Type
impl From<RangeInclusive<TyParam>> for Type
sourcefn from(r: RangeInclusive<TyParam>) -> Self
fn from(r: RangeInclusive<TyParam>) -> Self
Converts to this type from the input type.
sourceimpl LimitedDisplay for Type
impl LimitedDisplay for Type
fn limited_fmt(&self, f: &mut Formatter<'_>, limit: usize) -> Result
impl Eq for Type
Auto Trait Implementations
impl !RefUnwindSafe for Type
impl !Send for Type
impl !Sync for Type
impl Unpin for Type
impl !UnwindSafe for Type
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more